Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee2bc85fe7 | ||
|
|
9b3bfaabad | ||
|
|
3f8a227769 | ||
|
|
7993df1be7 | ||
|
|
f2b0b8359e | ||
|
|
7d7c053fc1 | ||
|
|
25398af8f5 | ||
|
|
c98971953c | ||
|
|
d9739755ce | ||
|
|
895bd2da15 | ||
|
|
8950e31f4c | ||
|
|
601928f49f | ||
|
|
773e243c88 | ||
|
|
311f3a6cf4 | ||
|
|
fed1b23b8b | ||
|
|
5c2d8f6901 | ||
|
|
68b88e40b5 | ||
|
|
6f3770a54a | ||
|
|
eaf2506b4f | ||
|
|
2cec4c8b52 | ||
|
|
7ebccc19db | ||
|
|
797d080df0 | ||
|
|
7c6b03145d | ||
|
|
7b136a62c4 | ||
|
|
fec433372d | ||
|
|
41a827727d | ||
|
|
bfd0f0c7c2 | ||
|
|
21c9ae8f7e | ||
|
|
581b503edf | ||
|
|
d380391d80 | ||
|
|
ff41393edd | ||
|
|
654784690e | ||
|
|
cd682e3961 | ||
|
|
cd4482dd97 | ||
|
|
6eb96a4992 | ||
|
|
3c3c59928d | ||
|
|
01911e4d37 | ||
|
|
37c65ca7e4 | ||
|
|
cb4ffe6f60 | ||
|
|
98f8b49e45 | ||
|
|
bf6be522ea | ||
|
|
2365ee9cb0 | ||
|
|
16c70e7b29 | ||
|
|
46f0385566 | ||
|
|
579c5ab052 | ||
|
|
94e7430dd9 | ||
|
|
7fea4894a2 | ||
|
|
a5b99199fc | ||
|
|
79e2596ce6 | ||
|
|
1b82918384 | ||
|
|
4e9e18df82 | ||
|
|
cec92474d2 | ||
|
|
d8f3dca2fc | ||
|
|
89576adbcf | ||
|
|
d9b8bd0b8c | ||
|
|
525f1b317c | ||
|
|
ac119f9d42 | ||
|
|
a18af5b3e0 | ||
|
|
ae87cdc8d9 | ||
|
|
f2f324c487 | ||
|
|
8cd848e44d | ||
|
|
d83842df55 | ||
|
|
0a0567c311 | ||
|
|
1c067d7eec | ||
|
|
1b5c155dda | ||
|
|
8065761c38 | ||
|
|
118bb5b107 | ||
|
|
d1db73342a | ||
|
|
f3e8630049 | ||
|
|
17b1369085 | ||
|
|
497b7e983e | ||
|
|
e8e24be6e1 | ||
|
|
52e2c2bc17 | ||
|
|
d5d3445fae | ||
|
|
f22fcbc31c | ||
|
|
275f2f7c28 | ||
|
|
b96663ffb8 | ||
|
|
939aedd384 | ||
|
|
b3509e46dd | ||
|
|
869ddb0b35 | ||
|
|
466ab2883b | ||
|
|
544c471a9c | ||
|
|
b3c1111cd3 | ||
|
|
2fa79155de | ||
|
|
8af91b8c9b | ||
|
|
7dae68561e | ||
|
|
c5476ff8f9 | ||
|
|
2071684fec | ||
|
|
50cde90736 | ||
|
|
b00538a123 | ||
|
|
1f900c4c75 | ||
|
|
72890d6ed4 | ||
|
|
1a13e70b37 | ||
|
|
21dcd757b5 | ||
|
|
817c4a4042 | ||
|
|
ea2281355a | ||
|
|
643c7a851d | ||
|
|
3d56f3f212 | ||
|
|
f086d9a698 | ||
|
|
e4cd3f8bb7 | ||
|
|
4647fd80b9 | ||
|
|
2ce9803257 | ||
|
|
90623359c7 | ||
|
|
8ecf4f26a7 | ||
|
|
b5c525a990 | ||
|
|
09fcff21ed | ||
|
|
eb229e1844 | ||
|
|
22bdf442d4 | ||
|
|
f92a7582c6 | ||
|
|
d158eae377 | ||
|
|
67c67ec1b0 | ||
|
|
6f998f922b | ||
|
|
859c0181a1 | ||
|
|
6a8bfb0da2 | ||
|
|
26fae628da | ||
|
|
7ce18078f0 | ||
|
|
c9289dec5a | ||
|
|
2ba311705f | ||
|
|
5201ccd6d2 | ||
|
|
74a6f76621 | ||
|
|
1702cc249d | ||
|
|
0fbe87a481 | ||
|
|
ad3a5e9329 | ||
|
|
2a3acc7286 | ||
|
|
e7fc777e57 | ||
|
|
5cd4b79ecf | ||
|
|
1af9e362e0 | ||
|
|
9c35e61f6c | ||
|
|
e2a1147eea | ||
|
|
503629024a | ||
|
|
1fa7eb24ac | ||
|
|
ac211aabe8 | ||
|
|
e9e501bb10 | ||
|
|
1bc674d73f | ||
|
|
10a724a048 | ||
|
|
7a780bf898 | ||
|
|
b9d6d510be | ||
|
|
5d98bde04c | ||
|
|
1059a7ca5e | ||
|
|
05173de41f | ||
|
|
ec1cd5f933 | ||
|
|
074be933ad | ||
|
|
41229be341 | ||
|
|
1336848f1d | ||
|
|
e10ed14a3c | ||
|
|
dc0e67515b | ||
|
|
6544851ba5 | ||
|
|
02fab76406 | ||
|
|
acb139a8c6 | ||
|
|
82fe3e5362 | ||
|
|
26b28f9b4d | ||
|
|
689f5add60 | ||
|
|
c444d4180e | ||
|
|
c4312e3f2f | ||
|
|
50526d2728 | ||
|
|
04edcd03f2 | ||
|
|
09cb8779e4 | ||
|
|
d86eec52ae | ||
|
|
e6a1e58405 | ||
|
|
ea10c9ac13 | ||
|
|
e6d3f3f27c | ||
|
|
f713b7fb60 | ||
|
|
c35a542d60 | ||
|
|
e6c699faf4 | ||
|
|
f626b4b031 | ||
|
|
aed81c0ff5 | ||
|
|
1354f2f302 | ||
|
|
8ea5d0f729 | ||
|
|
a4f5f3b7dc | ||
|
|
ab93865255 | ||
|
|
1ecdd3dae6 | ||
|
|
ddcd6b0d31 | ||
|
|
5196f1c5b9 | ||
|
|
e4afbc93fe | ||
|
|
ec62d20a7c | ||
|
|
9dd6ec718f | ||
|
|
69237d6a3a | ||
|
|
426cbee752 | ||
|
|
d8ed0681ab | ||
|
|
c2f3486e6d | ||
|
|
784093603e | ||
|
|
e4a575cc5e | ||
|
|
f00c9d8c23 | ||
|
|
9440a22e88 | ||
|
|
f70f7152ab | ||
|
|
8c7f35fa29 | ||
|
|
fe74e69da6 | ||
|
|
c170f53948 | ||
|
|
13fd825bcf | ||
|
|
8ee4fc2fa1 | ||
|
|
679a8387c9 | ||
|
|
00f3805721 | ||
|
|
ab2194e053 | ||
|
|
9044a46b31 | ||
|
|
53d76ea037 | ||
|
|
f3a28c83d8 | ||
|
|
b1e2986f65 | ||
|
|
267b53a90e | ||
|
|
e1b41d2c58 | ||
|
|
3204095afb | ||
|
|
538de7d2d2 | ||
|
|
2cba586d9c | ||
|
|
ad4d587a52 | ||
|
|
a929636a28 | ||
|
|
06a2508a9c | ||
|
|
64b2e2ee37 | ||
|
|
b6ef6eb801 | ||
|
|
b4d48cc9ec | ||
|
|
f83a937dc5 | ||
|
|
e2acb4c3fc | ||
|
|
5bf722a1fb | ||
|
|
0751484439 | ||
|
|
e5b16c7aa0 | ||
|
|
bac058d128 | ||
|
|
dd4a9ae890 | ||
|
|
f91687209b | ||
|
|
ec4140a9d2 | ||
|
|
2553c9e878 | ||
|
|
f9f33aa53a | ||
|
|
4455ebe58f | ||
|
|
35cfdea9e7 | ||
|
|
346433d248 | ||
|
|
16a7e69292 | ||
|
|
441824fc70 | ||
|
|
f46b77ab7b | ||
|
|
561af0e601 | ||
|
|
362c21505d | ||
|
|
d3d40de996 | ||
|
|
3ce4653bb5 | ||
|
|
a639c87a90 | ||
|
|
3aac16432a | ||
|
|
1c9ea1eb2e | ||
|
|
a47aea4c9f | ||
|
|
9cd0e6c385 | ||
|
|
c23a0f08c4 | ||
|
|
3ff865b1b6 | ||
|
|
cdedf1349c | ||
|
|
7beab3b582 | ||
|
|
b1b592f88d | ||
|
|
8737a40a4d | ||
|
|
71ce5be570 | ||
|
|
b883d02abb | ||
|
|
09f79a6934 | ||
|
|
9bdcfe9750 | ||
|
|
b767180473 | ||
|
|
acb5d96788 | ||
|
|
228a932598 | ||
|
|
b53cc6fd2b | ||
|
|
01cd8f5a0f | ||
|
|
9732e74bf3 | ||
|
|
2ed4a7b548 | ||
|
|
52c11d1444 | ||
|
|
78d50e4c43 | ||
|
|
7f05d27f42 | ||
|
|
3675fdd361 | ||
|
|
98dfe528d8 | ||
|
|
7da590df94 | ||
|
|
90cc5a6cb0 | ||
|
|
ca9277366c | ||
|
|
e79bf24bcd | ||
|
|
2c1201ff34 | ||
|
|
c4ff1a3aca | ||
|
|
5760f25c74 | ||
|
|
0a6f700c6f | ||
|
|
3147dfb012 | ||
|
|
5007a33bbf | ||
|
|
c65acfa90e | ||
|
|
b167c19137 | ||
|
|
d48b08856e | ||
|
|
9ba5c9a38b | ||
|
|
1a9f30a328 | ||
|
|
97058bfcf6 | ||
|
|
bd41bbb304 | ||
|
|
f47cb885cc | ||
|
|
1ab243d93a | ||
|
|
15d59cbbd8 | ||
|
|
c88d2dadb0 | ||
|
|
a4e96d2380 | ||
|
|
002c550263 | ||
|
|
25b9bc4100 | ||
|
|
7105606475 | ||
|
|
71e4005226 | ||
|
|
76b66b41b6 | ||
|
|
43e1331594 | ||
|
|
23ba3d493b | ||
|
|
487cbc495a | ||
|
|
faeb4d22ed | ||
|
|
9dc2ad4f32 | ||
|
|
ceae12baba | ||
|
|
58c58e9542 | ||
|
|
46c7bf8b03 | ||
|
|
c011d09e33 | ||
|
|
65fadcf709 | ||
|
|
e2b06aa600 | ||
|
|
7ab0a808a9 | ||
|
|
bc7ce5c983 | ||
|
|
6e55d88816 | ||
|
|
97f0ea1b0f | ||
|
|
684b016487 | ||
|
|
0b55e8df7b | ||
|
|
f9880e8413 | ||
|
|
c499a8387e |
No files matched your search
@@ -43,7 +43,7 @@ jobs:
|
||||
- v1-SRB2-APT
|
||||
- run:
|
||||
name: Install SDK
|
||||
command: apt-get -qq -y --no-install-recommends install git build-essential nasm libpng-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 libcurl4-openssl-dev:i386 libopenmpt-dev:i386 gettext ccache wget gcc-multilib upx openssh-client
|
||||
command: apt-get -qq -y --no-install-recommends install git build-essential libpng-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 libcurl4-openssl-dev:i386 libopenmpt-dev:i386 gettext ccache wget gcc-multilib upx openssh-client
|
||||
- save_cache:
|
||||
key: v1-SRB2-APT
|
||||
paths:
|
||||
|
||||
+436
@@ -0,0 +1,436 @@
|
||||
default:
|
||||
image: debian:stable-slim
|
||||
|
||||
stages: # List of stages for jobs, and their order of execution
|
||||
- build
|
||||
|
||||
variables:
|
||||
GIT_STRATEGY: clone
|
||||
GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_CONCURRENT_ID/$CI_PROJECT_PATH
|
||||
|
||||
.job_template: &job_build # This job runs in the build stage, which runs first.
|
||||
|
||||
stage: build
|
||||
|
||||
cache:
|
||||
- key: ccache-$CI_PROJECT_PATH_SLUG-$CI_JOB_NAME_SLUG
|
||||
fallback_keys:
|
||||
- cache-$CI_PROJECT_PATH_SLUG-$CI_DEFAULT_BRANCH
|
||||
- cache-$CI_PROJECT_PATH_SLUG-default
|
||||
paths:
|
||||
- ccache
|
||||
- ccache_statslog
|
||||
|
||||
- key: apt-$CI_JOB_IMAGE
|
||||
paths:
|
||||
- apt-cache
|
||||
unprotect: true
|
||||
|
||||
before_script:
|
||||
- - |
|
||||
# debconf
|
||||
echo -e "\e[0Ksection_start:`date +%s`:debconf[collapsed=true]\r\e[0KSetup debconf's environment"
|
||||
- export DEBIAN_FRONTEND="noninteractive"
|
||||
- export DEBIAN_PRIORITY="low"
|
||||
- export DEBCONF_NONINTERACTIVE_SEEN="true"
|
||||
- |
|
||||
# debconf
|
||||
echo -e "\e[0Ksection_end:`date +%s`:debconf\r\e[0K"
|
||||
- - |
|
||||
# dpkg_aa
|
||||
echo -e "\e[0Ksection_start:`date +%s`:dpkg_aa[collapsed=true]\r\e[0KAdding architectures to dpkg"
|
||||
- dpkg --add-architecture i386
|
||||
- dpkg --add-architecture amd64
|
||||
- dpkg --add-architecture arm64
|
||||
- |
|
||||
# dpkg_aa
|
||||
echo -e "\e[0Ksection_end:`date +%s`:dpkg_aa\r\e[0K"
|
||||
- - |
|
||||
# apt_conf
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_conf[collapsed=true]\r\e[0KSetting up APT conf"
|
||||
- export APT_CACHE_DIR=`pwd`/apt-cache
|
||||
- mkdir --parents --verbose $APT_CACHE_DIR/partial/
|
||||
- touch /etc/apt/apt.conf.d/99build
|
||||
- |
|
||||
# apt.conf
|
||||
echo Adding options to apt.conf':'
|
||||
- |
|
||||
# APT::Install-Recommends
|
||||
echo APT::Install-Recommends "false"\; | tee --append /etc/apt/apt.conf.d/99build
|
||||
- |
|
||||
# quit
|
||||
echo quiet "1"\; | tee --append /etc/apt/apt.conf.d/99build
|
||||
- |
|
||||
# APT::Get::Assume-Yes
|
||||
echo APT::Get::Assume-Yes "true"\; | tee --append /etc/apt/apt.conf.d/99build
|
||||
- |
|
||||
# Dir::Cache::Archives
|
||||
echo Dir::Cache::Archives "$APT_CACHE_DIR"\; | tee --append /etc/apt/apt.conf.d/99build
|
||||
- |
|
||||
# apt_conf
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_conf\r\e[0K"
|
||||
- - |
|
||||
# apt_update
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_update[collapsed=true]\r\e[0KUpdating APT listing"
|
||||
- apt-get update
|
||||
- |
|
||||
# apt_update
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_update\r\e[0K"
|
||||
|
||||
- - |
|
||||
# apt_pre
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_pre[collapsed=true]\r\e[0KInstalling pre packages"
|
||||
- apt-get install apt-utils
|
||||
- |
|
||||
# apt_pre
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_pre\r\e[0K"
|
||||
|
||||
- - |
|
||||
# apt_upgrade
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_upgrade[collapsed=true]\r\e[0KUpdating existing packages"
|
||||
- apt-get upgrade
|
||||
- |
|
||||
# apt_update
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_upgrade\r\e[0K"
|
||||
|
||||
- - |
|
||||
# apt_common
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_common[collapsed=true]\r\e[0KInstalling common packages"
|
||||
- apt-get install make git ccache
|
||||
- |
|
||||
# apt_common
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_common\r\e[0K"
|
||||
|
||||
- - |
|
||||
# ccache_config
|
||||
echo -e "\e[0Ksection_start:`date +%s`:ccache_config[collapsed=true]\r\e[0KSetting up ccache config"
|
||||
- mkdir --parents --verbose ~/.ccache/
|
||||
- touch ~/.ccache/ccache.conf
|
||||
- |
|
||||
# cache.conf
|
||||
echo Adding ccache configution option
|
||||
- |
|
||||
# base_dir
|
||||
echo base_dir = $PWD | tee --append ~/.ccache/ccache.conf
|
||||
- |
|
||||
# cache_dir
|
||||
echo cache_dir = $PWD/ccache | tee --append ~/.ccache/ccache.conf
|
||||
- |
|
||||
# compiler_check
|
||||
echo compiler_check = content | tee --append ~/.ccache/ccache.conf
|
||||
- |
|
||||
# stats_log
|
||||
echo stats_log = $PWD/ccache_statslog | tee --append ~/.ccache/ccache.conf
|
||||
- |
|
||||
# max_size
|
||||
echo max_size = 50M | tee --append ~/.ccache/ccache.conf
|
||||
- |
|
||||
# ccache_config
|
||||
echo -e "\e[0Ksection_end:`date +%s`:ccache_config\r\e[0K"
|
||||
|
||||
- - |
|
||||
# cache_reset
|
||||
echo -e "\e[0Ksection_start:`date +%s`:ccache_reset[collapsed=true]\r\e[0KResetting ccache statistics"
|
||||
- ccache --zero-stats
|
||||
- ccache --show-stats
|
||||
- |
|
||||
# ccache_reset
|
||||
echo -e "\e[0Ksection_end:`date +%s`:ccache_reset\r\e[0K"
|
||||
|
||||
after_script:
|
||||
- - |
|
||||
# apt_clean
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_clean[collapsed=true]\r\e[0KCleaning of unneeded APT packages"
|
||||
- apt-get autoclean
|
||||
- |
|
||||
# apt_clean
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_clean\r\e[0K"
|
||||
|
||||
- - |
|
||||
# ccache_stats
|
||||
echo -e "\e[0Ksection_start:`date +%s`:ccache_stats[collapsed=true]\r\e[0Kccache statistics:"
|
||||
- ccache --show-stats --verbose
|
||||
- ccache --show-log-stats --verbose
|
||||
- |
|
||||
# ccahe_stats
|
||||
echo -e "\e[0Ksection_end:`date +%s`:ccache_stats\r\e[0K"
|
||||
|
||||
Debian testing GCC:
|
||||
<<: *job_build
|
||||
image: debian:testing-slim
|
||||
|
||||
allow_failure: true
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
- "bin/"
|
||||
- "src/comptime.h"
|
||||
expose_as: "Debian GCC testing"
|
||||
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-testing-gcc"
|
||||
|
||||
variables:
|
||||
CC: gcc
|
||||
|
||||
script:
|
||||
- - |
|
||||
# apt_toolchain
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
|
||||
- apt-get install gcc
|
||||
- |
|
||||
# apt_toolchain
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
|
||||
|
||||
- - |
|
||||
# apt_development
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages"
|
||||
- apt-get install libsdl2-mixer-dev libpng-dev libcurl4-openssl-dev libgme-dev libopenmpt-dev
|
||||
- |
|
||||
# apt_development
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K"
|
||||
|
||||
- - |
|
||||
# make
|
||||
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
|
||||
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1
|
||||
- |
|
||||
# make
|
||||
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
|
||||
|
||||
Windows x86:
|
||||
<<: *job_build
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
- "bin/"
|
||||
- "src/comptime.h"
|
||||
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win32"
|
||||
|
||||
variables:
|
||||
PREFIX: i686-w64-mingw32
|
||||
|
||||
script:
|
||||
- - |
|
||||
# apt_toolchain
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
|
||||
- apt-get install gcc-mingw-w64-i686-win32
|
||||
- |
|
||||
# apt_toolchain
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
|
||||
|
||||
- - |
|
||||
# make
|
||||
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
|
||||
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW=1 SDL=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW=1 SDL=1
|
||||
- |
|
||||
# make
|
||||
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
|
||||
|
||||
Debian stable:amd64:
|
||||
<<: *job_build
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
- "bin/"
|
||||
- "src/comptime.h"
|
||||
expose_as: "Debian amd64"
|
||||
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-x86-64"
|
||||
|
||||
variables:
|
||||
CC: x86_64-linux-gnu-gcc
|
||||
OBJCOPY: x86_64-linux-gnu-objcopy
|
||||
OBJDUMP: x86_64-linux-gnu-objdump
|
||||
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig
|
||||
|
||||
script:
|
||||
- - |
|
||||
# apt_toolchain
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
|
||||
- apt-get install gcc-x86-64-linux-gnu || apt-get install gcc
|
||||
- |
|
||||
# apt_toolchain
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
|
||||
|
||||
- - |
|
||||
# apt_development
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages"
|
||||
- apt-get install libsdl2-mixer-dev:amd64 libpng-dev:amd64 libcurl4-openssl-dev:amd64 libgme-dev:amd64 libopenmpt-dev:amd64
|
||||
- |
|
||||
# apt_development
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K"
|
||||
|
||||
- - |
|
||||
# make
|
||||
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
|
||||
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1
|
||||
- |
|
||||
# make
|
||||
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
|
||||
|
||||
Debian stable:i386:
|
||||
<<: *job_build
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
- "bin/"
|
||||
- "src/comptime.h"
|
||||
expose_as: "Debian i386"
|
||||
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-i686"
|
||||
|
||||
variables:
|
||||
CC: i686-linux-gnu-gcc
|
||||
OBJCOPY: i686-linux-gnu-objcopy
|
||||
OBJDUMP: i686-linux-gnu-objdump
|
||||
PKG_CONFIG_PATH: /usr/lib/i386-linux-gnu/pkgconfig
|
||||
|
||||
script:
|
||||
- - |
|
||||
# apt_toolchain
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
|
||||
- apt-get install gcc-i686-linux-gnu || apt-get install gcc
|
||||
- |
|
||||
# apt_toolchain
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
|
||||
|
||||
- - |
|
||||
# apt_development
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages"
|
||||
- apt-get install libsdl2-mixer-dev:i386 libpng-dev:i386 libcurl4-openssl-dev:i386 libgme-dev:i386 libopenmpt-dev:i386
|
||||
- |
|
||||
# apt_development
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K"
|
||||
|
||||
- - |
|
||||
# make
|
||||
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
|
||||
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX=1
|
||||
- |
|
||||
# make
|
||||
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
|
||||
|
||||
Debian stable:arm64:
|
||||
<<: *job_build
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
- "bin/"
|
||||
- "src/comptime.h"
|
||||
expose_as: "Debian arm64"
|
||||
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-aarch64"
|
||||
|
||||
variables:
|
||||
CC: aarch64-linux-gnu-gcc
|
||||
OBJCOPY: aarch64-linux-gnu-objcopy
|
||||
OBJDUMP: aarch64-linux-gnu-objdump
|
||||
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig
|
||||
|
||||
script:
|
||||
- - |
|
||||
# apt_toolchain
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
|
||||
- apt-get install gcc-aarch64-linux-gnu || apt-get install gcc
|
||||
- |
|
||||
# apt_toolchain
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
|
||||
|
||||
- - |
|
||||
# apt_development
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages"
|
||||
- apt-get install libsdl2-mixer-dev:arm64 libpng-dev:arm64 libcurl4-openssl-dev:arm64 libgme-dev:arm64 libopenmpt-dev:arm64
|
||||
- |
|
||||
# apt_development
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K"
|
||||
|
||||
- - |
|
||||
# make
|
||||
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
|
||||
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 NONX86=1
|
||||
- |
|
||||
# make
|
||||
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
|
||||
|
||||
Windows x64:
|
||||
<<: *job_build
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
- "bin/"
|
||||
- "src/comptime.h"
|
||||
expose_as: "Win64"
|
||||
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win64"
|
||||
|
||||
variables:
|
||||
PREFIX: x86_64-w64-mingw32
|
||||
|
||||
script:
|
||||
- - |
|
||||
# apt_toolchain
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
|
||||
- apt-get install gcc-mingw-w64-x86-64-win32
|
||||
- |
|
||||
# apt_toolchain
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
|
||||
|
||||
- - |
|
||||
# make
|
||||
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
|
||||
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW64=1 SDL=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW64=1 SDL=1
|
||||
- |
|
||||
# make
|
||||
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
|
||||
|
||||
Debian stable Clang:
|
||||
<<: *job_build
|
||||
|
||||
allow_failure: true
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
- "bin/"
|
||||
- "src/comptime.h"
|
||||
expose_as: "Debian Clang"
|
||||
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-clang"
|
||||
|
||||
variables:
|
||||
CC: clang
|
||||
WFLAGS: -Wno-cast-align
|
||||
|
||||
script:
|
||||
- - |
|
||||
# apt_toolchain
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
|
||||
- apt-get install clang
|
||||
- |
|
||||
# apt_toolchain
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
|
||||
|
||||
- - |
|
||||
# apt_development
|
||||
echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages"
|
||||
- apt-get install libsdl2-mixer-dev libpng-dev libcurl4-openssl-dev libgme-dev libopenmpt-dev
|
||||
- |
|
||||
# apt_development
|
||||
echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K"
|
||||
|
||||
- - |
|
||||
# make
|
||||
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
|
||||
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1
|
||||
- |
|
||||
# make
|
||||
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
|
||||
|
||||
Debian testing Clang:
|
||||
extends: Debian stable Clang
|
||||
|
||||
image: debian:testing-slim
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
- "bin/"
|
||||
- "src/comptime.h"
|
||||
expose_as: "Debina Clang testing"
|
||||
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-testing-clang"
|
||||
|
||||
variables:
|
||||
CC: clang
|
||||
WFLAGS: -Wno-cast-align -Wno-deprecated-non-prototype
|
||||
@@ -109,13 +109,10 @@ FILE_PATTERNS = *.c \
|
||||
*.mm \
|
||||
*.dox
|
||||
RECURSIVE = YES
|
||||
EXCLUDE = ./src/djgppdos/internal.h \
|
||||
./src/djgppdos/setup.c \
|
||||
./src/sdl/IMG_xpm.c \
|
||||
EXCLUDE = ./src/sdl/IMG_xpm.c \
|
||||
./src/sdl/SRB2DC/scramble.c
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS = */src/hardware/*/* \
|
||||
*/src/djgppdos/bcd.? \
|
||||
*/src/sdl/SDL_main/* \
|
||||
*/src/*/*_private.h \
|
||||
*/src/sdl/*/*help.? \
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
# SRB2Kart Saturn: Custom lua features
|
||||
|
||||
## mobj.localskin and player.localskin fields
|
||||
|
||||
Allow reading and assigning localskins to players. Local skins for other objects aren't supported currently.
|
||||
|
||||
## mobj.rollsum field
|
||||
|
||||
**Not netsafe**. Returns total sprite rotation value, taking sliptideroll and sloperoll cvars value into account.
|
||||
Mainly for use in visual-only addons like secondcolor.
|
||||
|
||||
## player.sliproll field
|
||||
|
||||
**Not netsafe**. Returns player's current sliptide roll angle, taking sliptideroll cvar value into account.
|
||||
|
||||
## hud.setVoteBackground(name)
|
||||
|
||||
Changes vote background texture prefix (game looks for PREFIX + "W" or "C" (depends on resolution) + FRAME\_NUMBER).
|
||||
|
||||
## hud.add(fn, "vote") and hud.add(fn, "intermission")
|
||||
|
||||
Hud hooks for vote screen and intermission screen. They only get drawer (`v`) as argument.
|
||||
To check if those hooks are available, check if globals FEATURE\_VOTEHUD and FEATURE\_INERMISSIONHUD
|
||||
exist.
|
||||
|
||||
## mobj.spritexscale, mobj.spriteyscale, mobj.spritexoffset, mobj.spriteyoffset, mobj.rollangle, mobj.sloperoll, mobj.rollmodel fields
|
||||
|
||||
Same fields as in SRB2 2.2
|
||||
|
||||
## S\_StopSoundByNum
|
||||
|
||||
Allows stopping specific sound globally. Because this function starts with S\_, like state, checking
|
||||
if it exists is a bit more complicated:
|
||||
|
||||
```lua
|
||||
if rawget(_G, "S_StopSoundByNum") ~= nil then
|
||||
... -- Can use it
|
||||
end
|
||||
```
|
||||
@@ -6,29 +6,34 @@
|
||||
|
||||
- Sprites player rotation on slopes; going on hills, levitate, going down, and so on alters your sprites (configurable)
|
||||
- You can alter all the base kart HUD element offsets on the fly in the Saturn Options settings menu
|
||||
- "addfilelocal" Command, for those who want to use things like their custom hud in netgames (Same as addfile but completely client sided)
|
||||
- OpenMPT for Tracker module playback (Complete with filters) fixed looping issues while even sounding better than the old GME playback
|
||||
- `addfilelocal` Command, for those who want to use things like their custom hud in netgames (Same as addfile but completely client sided)
|
||||
- OpenMPT for Tracker module playback instead of GME
|
||||
- Fixes looping and sounds better
|
||||
- Allows filter configuration
|
||||
- The minimal brightness with Shaders can be configured, now you can seeeee in dark areas (0-255 , uses Sector brightness values)
|
||||
- Lua hooks for Intermission (ex: You can make hostmod votes still visible during intermission!)
|
||||
- Lua hooks for Vote Screen (ex: You can make hostmod votes still visible during map vote screen!)
|
||||
- Lua HUD hooks for Intermission (ex: You can make hostmod votes still visible during intermission!)
|
||||
- Lua HUD hooks for Vote Screen (ex: You can make hostmod votes still visible during map vote screen!)
|
||||
- Saltyhop! do a funny hop
|
||||
- Smaller Speedometer (optional / requieres extra.kart file)
|
||||
- Record Attack input display can now be used everywhere
|
||||
- Smaller minimap icons and also show player names on the minimap (toggable)
|
||||
- "showmusiccredits" command, shows you the current music track again
|
||||
- "listskins" show a list of all skins currently loaded
|
||||
- Visual Portals from Haya´s HEP Client
|
||||
- Toggable lowercase menu´s also from Haya´s HEP client
|
||||
- `showmusiccredit` command, shows you the current music track again
|
||||
- `listskins` show a list of all skins currently loaded
|
||||
- Visual Portals from Haya's HEP Client
|
||||
- Toggable lowercase menu's also from Haya's HEP client
|
||||
- Everything that Galaxy has
|
||||
|
||||
## Improvements / Bug fixes
|
||||
|
||||
- Replay size has been increased to 10MiB minimum, to make replay overflows very unlikely to happen (can be set to 100MiB max with "maxdemosize" command in console)
|
||||
- Music changes now properly show the music credits (ex: Kart maps with easter eggs that alter the music) *The mapper still has to provide a MusicDEF for this to work.
|
||||
- Replay size has been increased to 10MiB minimum, to make replay overflows very unlikely to happen
|
||||
- can be set to 100MiB max with `maxdemosize` command in console
|
||||
- Music changes now properly show the music credits (ex: Kart maps with easter eggs that alter the music)
|
||||
- The mapper still has to provide a MusicDEF for this to work.
|
||||
- Configurable chatlog length (yay can read those messages from 30 mins ago without opening log.txt)
|
||||
- Configurable timeout for waiting to join a full server (in vanilla this is capped to 5 minutes before it boots you out)
|
||||
- Characters now spin in skin selection menu (configurable)
|
||||
- HTTP Addon download speed has been raised dramatically (configurable with "downloadspeed" command)
|
||||
- HTTP Addon download speed has been raised dramatically
|
||||
- configurable with `downloadspeed` command
|
||||
- HWR Drawnodes have been refactored, this should fix a few rare crashes esp in regards to OpenGL Visportals
|
||||
- The Position Number in the corner is alot smaller now (half the size!)
|
||||
- Toggable Lap animation
|
||||
@@ -40,17 +45,18 @@
|
||||
- Access for `mobj_t` and `player_t` fields from Lua has been completely rewritten, for much better performance with many Lua scripts
|
||||
- Lua shows Tracebacks whenever an error occurs
|
||||
- The Lua Perfstats page now has multiple pages and is more organized (ps_thinkframe_page X in console)
|
||||
- People with lower end hardware can disable "screen textures" with "gr_screentextures" command, huge performance gain with minimal visual loss (Note intermission screen background is broken with this)
|
||||
- Software mode has gotten "ffloorclip", which boosts performance on maps with many Floor over Floor roads
|
||||
- People with lower end hardware can disable "screen textures" with "gr_screentextures" command, huge performance gain with minimal visual loss
|
||||
- Intermission backgrounds, heat wave effects and etc are broken with this
|
||||
- `ffloorclip`, exclusive to Software, which boosts performance on maps with many Floor over Floor sectors
|
||||
|
||||
## Technical fixes
|
||||
|
||||
- ZFigthing Textures in Opengl mode have been fixed in engine (well almost all of it)
|
||||
- Fof's intersecting with slopes have less issues and now render correctly in Opengl
|
||||
- FOFs intersecting with slopes have less issues and now render correctly in Opengl
|
||||
- Midtextures on slopes in Opengl are fixed, many weird guardrails and fences, aswell as some of those sticking out textures from the ground on some maps should be gone
|
||||
- The annoying depraction messages for "P_TeleportMove" and "P_AproxDistance" have been silenced
|
||||
- The annoying depraction messages for `P_TeleportMove` and `P_AproxDistance` have been silenced
|
||||
- Silenced the annoying "cant find next map..." messages as theyre super useless and annoying anyways
|
||||
- Added a small cooldown on "map" command due to spamming causing a SIGSEGV
|
||||
- Added a small cooldown on `map` command due to spamming causing a SIGSEGV
|
||||
|
||||
## MISC
|
||||
- Bird's Camara Tilting feature is no longer turned on by default
|
||||
@@ -62,7 +68,6 @@
|
||||
- You tell us! c:
|
||||
|
||||
## Dependencies
|
||||
- NASM (x86 builds only)
|
||||
- SDL2 (Linux/OS X only)
|
||||
- SDL2-Mixer (Linux/OS X only)
|
||||
- libupnp (Linux/OS X only)
|
||||
|
||||
@@ -1996,24 +1996,6 @@ HW3SOUND for 3D hardware sound support
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="src/v_video.h" />
|
||||
<Unit filename="src/vid_copy.s">
|
||||
<Option compilerVar="CC" />
|
||||
<Option compiler="avrgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
||||
<Option compiler="gnu_gcc_compiler_for_mingw32" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
||||
<Option compiler="gnu_gcc_compiler_for_mingw64" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
||||
<Option compiler="armelfgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
||||
<Option compiler="tricoregcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
||||
<Option compiler="ppcgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
||||
<Option compiler="gcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
||||
<Option target="Debug Native/SDL" />
|
||||
<Option target="Release Native/SDL" />
|
||||
<Option target="Debug Linux/SDL" />
|
||||
<Option target="Release Linux/SDL" />
|
||||
<Option target="Debug Mingw/SDL" />
|
||||
<Option target="Release Mingw/SDL" />
|
||||
<Option target="Debug Mingw/DirectX" />
|
||||
<Option target="Release Mingw/DirectX" />
|
||||
</Unit>
|
||||
<Unit filename="src/w_wad.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
|
||||
@@ -25,9 +25,6 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(PlatformTarget)'=='x86'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>USEASM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
|
||||
@@ -5,7 +5,7 @@ Ver=3
|
||||
IsCpp=0
|
||||
Type=0
|
||||
UnitCount=279
|
||||
Folders=A_Asm,B_Bot,BLUA,D_Doom,F_Frame,G_Game,H_Hud,Hw_Hardware,Hw_Hardware/r_opengl,I_Interface,I_Interface/Dummy,I_Interface/SDL,I_Interface/Win32,LUA,M_Misc,P_Play,R_Rend,S_Sounds,W_Wad
|
||||
Folders=B_Bot,BLUA,D_Doom,F_Frame,G_Game,H_Hud,Hw_Hardware,Hw_Hardware/r_opengl,I_Interface,I_Interface/Dummy,I_Interface/SDL,I_Interface/Win32,LUA,M_Misc,P_Play,R_Rend,S_Sounds,W_Wad
|
||||
CommandLine=
|
||||
CompilerSettings=00000000000100000111e1
|
||||
PchHead=-1
|
||||
@@ -1473,36 +1473,6 @@ Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit149]
|
||||
FileName=src\tmap.nas
|
||||
Folder=A_Asm
|
||||
Compile=0
|
||||
CompileCpp=0
|
||||
Link=0
|
||||
Priority=1000
|
||||
OverrideBuildCmd=1
|
||||
BuildCmd=nasm.exe -g -o $@ -f win32 src/tmap.nas
|
||||
|
||||
[Unit150]
|
||||
FileName=src\asm_defs.inc
|
||||
Folder=A_Asm
|
||||
Compile=0
|
||||
CompileCpp=0
|
||||
Link=0
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit151]
|
||||
FileName=src\vid_copy.s
|
||||
Folder=A_Asm
|
||||
Compile=1
|
||||
CompileCpp=0
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=1
|
||||
BuildCmd=$(CC) $(CFLAGS) -x assembler-with-cpp -c src/vid_copy.s -o $@
|
||||
|
||||
[Unit152]
|
||||
FileName=src\y_inter.h
|
||||
Folder=H_Hud
|
||||
@@ -1543,26 +1513,6 @@ Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit156]
|
||||
FileName=src\p5prof.h
|
||||
Folder=A_Asm
|
||||
Compile=1
|
||||
CompileCpp=0
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit157]
|
||||
FileName=src\tmap_mmx.nas
|
||||
Folder=A_Asm
|
||||
Compile=0
|
||||
CompileCpp=0
|
||||
Link=0
|
||||
Priority=1000
|
||||
OverrideBuildCmd=1
|
||||
BuildCmd=nasm.exe -g -o $@ -f win32 src/tmap_mmx.nas
|
||||
|
||||
[Unit159]
|
||||
FileName=src\lzf.h
|
||||
Folder=W_Wad
|
||||
|
||||
@@ -11,8 +11,6 @@ environment:
|
||||
# c:\msys64 x86_64 has gcc 8.2.0, so use c:\mingw-w64 7.3.0 instead
|
||||
MINGW_SDK_64: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64
|
||||
CFLAGS: -Wall -W -Werror -Wno-error=implicit-fallthrough -Wimplicit-fallthrough=3 -Wno-tautological-compare -Wno-error=suggest-attribute=noreturn
|
||||
NASM_ZIP: nasm-2.12.01
|
||||
NASM_URL: http://www.nasm.us/pub/nasm/releasebuilds/2.12.01/win64/nasm-2.12.01-win64.zip
|
||||
UPX_ZIP: upx391w
|
||||
UPX_URL: http://upx.sourceforge.net/download/upx391w.zip
|
||||
CCACHE_EXE: ccache.exe
|
||||
@@ -46,7 +44,6 @@ environment:
|
||||
ASSET_CLEAN: 0
|
||||
|
||||
cache:
|
||||
- nasm-2.12.01.zip
|
||||
- upx391w.zip
|
||||
- ccache.exe
|
||||
- C:\Users\appveyor\.ccache
|
||||
@@ -58,10 +55,6 @@ install:
|
||||
- if [%X86_64%] == [1] ( set "MINGW_SDK=%MINGW_SDK_64%" )
|
||||
- if [%X86_64%] == [1] ( set "CCACHE_CC=%CCACHE_CC_64%" )
|
||||
|
||||
- if not exist "%NASM_ZIP%.zip" appveyor DownloadFile "%NASM_URL%" -FileName "%NASM_ZIP%.zip"
|
||||
- 7z x -y "%NASM_ZIP%.zip" -o%TMP% >null
|
||||
- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs "%TMP%\%NASM_ZIP%" "%MINGW_SDK%\bin" nasm.exe || exit 0
|
||||
|
||||
- if not exist "%UPX_ZIP%.zip" appveyor DownloadFile "%UPX_URL%" -FileName "%UPX_ZIP%.zip"
|
||||
- 7z x -y "%UPX_ZIP%.zip" -o%TMP% >null
|
||||
- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs "%TMP%\%UPX_ZIP%" "%MINGW_SDK%\bin" upx.exe || exit 0
|
||||
@@ -78,7 +71,6 @@ before_build:
|
||||
- set "Path=%MINGW_SDK%\bin;%Path%"
|
||||
- if [%X86_64%] == [1] ( x86_64-w64-mingw32-gcc --version ) else ( i686-w64-mingw32-gcc --version )
|
||||
- mingw32-make --version
|
||||
- if not [%X86_64%] == [1] ( nasm -v )
|
||||
- if not [%NOUPX%] == [1] ( upx -V )
|
||||
- ccache -V
|
||||
- ccache -s
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,5 +0,0 @@
|
||||
/*.elf
|
||||
/*.self
|
||||
/*.pkg
|
||||
/*.BIN
|
||||
/pkg
|
||||
@@ -1,5 +0,0 @@
|
||||
/*.elf
|
||||
/*.self
|
||||
/*.pkg
|
||||
/*.BIN
|
||||
/pkg
|
||||
@@ -1,4 +0,0 @@
|
||||
/EBOOT.PBP
|
||||
/PARAM.SFO
|
||||
/SRB2PSP.PBP
|
||||
/SRB2PSP.elf
|
||||
@@ -1,3 +0,0 @@
|
||||
/*.elf
|
||||
/*.dol
|
||||
/apps
|
||||
@@ -1,3 +0,0 @@
|
||||
/*.elf
|
||||
/*.dol
|
||||
/apps
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,3 +0,0 @@
|
||||
*.arm9
|
||||
*.elf*
|
||||
*.nds
|
||||
@@ -1,3 +0,0 @@
|
||||
*.arm9
|
||||
*.elf*
|
||||
*.nds
|
||||
@@ -1,46 +0,0 @@
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2010 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# support for the yasm assembler
|
||||
|
||||
set(CMAKE_ASM_YASM_SOURCE_FILE_EXTENSIONS nasm yasm asm)
|
||||
|
||||
if(NOT CMAKE_ASM_YASM_OBJECT_FORMAT)
|
||||
if(WIN32)
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT win64)
|
||||
else()
|
||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT win32)
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT macho64)
|
||||
else()
|
||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT macho)
|
||||
endif()
|
||||
else()
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT elf64)
|
||||
else()
|
||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT elf)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_ASM_YASM_COMPILE_OBJECT "<CMAKE_ASM_YASM_COMPILER> <FLAGS> -f ${CMAKE_ASM_YASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>")
|
||||
|
||||
# Load the generic ASMInformation file:
|
||||
set(ASM_DIALECT "_YASM")
|
||||
include(CMakeASMInformation)
|
||||
set(ASM_DIALECT)
|
||||
@@ -1,27 +0,0 @@
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2010 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# Find the nasm assembler. yasm (http://www.tortall.net/projects/yasm/) is nasm compatible
|
||||
|
||||
set(CMAKE_ASM_YASM_COMPILER_LIST nasm yasm)
|
||||
|
||||
if(NOT CMAKE_ASM_YASM_COMPILER)
|
||||
find_program(CMAKE_ASM_YASM_COMPILER yasm
|
||||
"$ENV{ProgramFiles}/YASM")
|
||||
endif()
|
||||
|
||||
# Load the generic DetermineASM compiler file with the DIALECT set properly:
|
||||
set(ASM_DIALECT "_YASM")
|
||||
include(CMakeDetermineASMCompiler)
|
||||
set(ASM_DIALECT)
|
||||
@@ -1,23 +0,0 @@
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2010 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# This file is used by EnableLanguage in cmGlobalGenerator to
|
||||
# determine that the selected ASM_NASM "compiler" works.
|
||||
# For assembler this can only check whether the compiler has been found,
|
||||
# because otherwise there would have to be a separate assembler source file
|
||||
# for each assembler on every architecture.
|
||||
|
||||
set(ASM_DIALECT "_YASM")
|
||||
include(CMakeTestASMCompiler)
|
||||
set(ASM_DIALECT)
|
||||
+23
-32
@@ -1,54 +1,45 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/sh
|
||||
path="."
|
||||
if [ x"$1" != x ]; then
|
||||
path="$1"
|
||||
fi
|
||||
|
||||
versiongit() {
|
||||
gitbranch=`git rev-parse --abbrev-ref HEAD`
|
||||
gitversion=`git rev-parse HEAD`
|
||||
cat <<EOF > $path/comptime.h
|
||||
version() {
|
||||
cat <<EOF > "$path/comptime.h"
|
||||
|
||||
// Do not edit! This file was autogenerated
|
||||
// by the $0 script with git
|
||||
//
|
||||
const char* compbranch = "$gitbranch";
|
||||
const char* comprevision = "${gitversion:0:8}";
|
||||
const char* compbranch = "$1";
|
||||
const char* comprevision = "$2";
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
versiongit() {
|
||||
gitbranch="$(git rev-parse --abbrev-ref HEAD)"
|
||||
gitversion="$(git rev-parse HEAD | cut -c -8)"
|
||||
version "$gitbranch" "$gitversion";
|
||||
exit 0
|
||||
}
|
||||
|
||||
versionsvn() {
|
||||
svnrevision=`svnversion -n $1`
|
||||
cat <<EOF > $path/comptime.h
|
||||
|
||||
// Do not edit! This file was autogenerated
|
||||
// by the $0 script with subversion
|
||||
//
|
||||
const char* compbranch = "Subversion";
|
||||
const char* comprevision = "r$svnrevision";
|
||||
EOF
|
||||
exit 0
|
||||
svnrevision="$(svnversion -n "$1")"
|
||||
version "Subversion" "r$svnrevision";
|
||||
exit 0
|
||||
}
|
||||
|
||||
versionfake() {
|
||||
cat <<EOF > $path/comptime.h
|
||||
|
||||
// Do not edit! This file was autogenerated
|
||||
// by the $0 script with an unknown or nonexist SCM
|
||||
//
|
||||
const char* compbranch = "Unknown";
|
||||
const char* comprevision = "illegal";
|
||||
EOF
|
||||
version "Unknown" "illegal";
|
||||
}
|
||||
|
||||
compversion() {
|
||||
touch $path/comptime.c
|
||||
versionfake
|
||||
test -d $path/.svn && versionsvn
|
||||
test -d $path/../.git && versiongit
|
||||
exit 1
|
||||
touch "$path/comptime.c"
|
||||
versionfake
|
||||
[ -d "$path/.svn" ] && versionsvn "$@"
|
||||
[ -d "$path/../.git" ] && versiongit
|
||||
exit 1
|
||||
}
|
||||
|
||||
test -f $path/comptime.c && compversion
|
||||
[ -f "$path/comptime.c" ] && compversion "$@"
|
||||
exit 2
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
@@ -1,2 +0,0 @@
|
||||
# DON'T REMOVE
|
||||
# This keeps the folder from disappearing
|
||||
+1
-1
@@ -76,7 +76,7 @@ LOCAL_SRC_FILES := am_map.c \
|
||||
android/i_system.c \
|
||||
android/i_video.c
|
||||
|
||||
LOCAL_CFLAGS += -DPLATFORM_ANDROID -DNONX86 -DLINUX -DDEBUGMODE -DNOASM -DNOPIX -DUNIXCOMMON -DNOTERMIOS
|
||||
LOCAL_CFLAGS += -DPLATFORM_ANDROID -DNONX86 -DLINUX -DDEBUGMODE -DNOPIX -DUNIXCOMMON -DNOTERMIOS
|
||||
|
||||
LOCAL_MODULE := libsrb2
|
||||
|
||||
|
||||
+2
-52
@@ -3,6 +3,7 @@
|
||||
# Core sources
|
||||
set(SRB2_CORE_SOURCES
|
||||
am_map.c
|
||||
args.c
|
||||
b_bot.c
|
||||
command.c
|
||||
comptime.c
|
||||
@@ -52,6 +53,7 @@ set(SRB2_CORE_SOURCES
|
||||
|
||||
set(SRB2_CORE_HEADERS
|
||||
am_map.h
|
||||
args.h
|
||||
b_bot.h
|
||||
byteptr.h
|
||||
command.h
|
||||
@@ -196,32 +198,6 @@ source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS})
|
||||
source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES})
|
||||
source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES})
|
||||
|
||||
|
||||
set(SRB2_ASM_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/vid_copy.s
|
||||
)
|
||||
|
||||
set(SRB2_NASM_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tmap_mmx.nas
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tmap.nas
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
list(APPEND SRB2_NASM_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/tmap_vc.nas)
|
||||
endif()
|
||||
|
||||
set(SRB2_NASM_OBJECTS
|
||||
${CMAKE_CURRENT_BINARY_DIR}/tmap_mmx.obj
|
||||
${CMAKE_CURRENT_BINARY_DIR}/tmap.obj
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
list(APPEND SRB2_NASM_OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/tmap_vc.obj)
|
||||
endif()
|
||||
|
||||
source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES})
|
||||
|
||||
|
||||
### Configuration
|
||||
set(SRB2_CONFIG_HAVE_BLUA ON CACHE BOOL
|
||||
"Enable Lua interpreter support")
|
||||
@@ -239,10 +215,6 @@ set(SRB2_CONFIG_HAVE_CURL ON CACHE BOOL
|
||||
"Enable curl support, used for downloading files via HTTP.")
|
||||
set(SRB2_CONFIG_HWRENDER ON CACHE BOOL
|
||||
"Enable hardware rendering through OpenGL.")
|
||||
set(SRB2_CONFIG_USEASM OFF CACHE BOOL
|
||||
"Enable NASM tmap implementation for software mode speedup.")
|
||||
set(SRB2_CONFIG_YASM OFF CACHE BOOL
|
||||
"Use YASM in place of NASM.")
|
||||
set(SRB2_CONFIG_STATIC_OPENGL OFF CACHE BOOL
|
||||
"Use statically linked OpenGL. NOT RECOMMENDED.")
|
||||
|
||||
@@ -533,28 +505,6 @@ if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_USEASM})
|
||||
#SRB2_ASM_FLAGS can be used to pass flags to either nasm or yasm.
|
||||
if(${CMAKE_SYSTEM} MATCHES "Linux")
|
||||
set(SRB2_ASM_FLAGS "-DLINUX ${SRB2_ASM_FLAGS}")
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_YASM})
|
||||
set(CMAKE_ASM_YASM_SOURCE_FILE_EXTENSIONS ${CMAKE_ASM_YASM_SOURCE_FILE_EXTENSIONS} nas)
|
||||
set(CMAKE_ASM_YASM_FLAGS "${SRB2_ASM_FLAGS}" CACHE STRING "Flags used by the assembler during all build types.")
|
||||
enable_language(ASM_YASM)
|
||||
else()
|
||||
set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS ${CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS} nas)
|
||||
set(CMAKE_ASM_NASM_FLAGS "${SRB2_ASM_FLAGS}" CACHE STRING "Flags used by the assembler during all build types.")
|
||||
enable_language(ASM_NASM)
|
||||
endif()
|
||||
set(SRB2_USEASM ON)
|
||||
add_definitions(-DUSEASM)
|
||||
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -msse3 -mfpmath=sse)
|
||||
else()
|
||||
set(SRB2_USEASM OFF)
|
||||
add_definitions(-DNONX86 -DNORUSEASM)
|
||||
endif()
|
||||
|
||||
# Targets
|
||||
|
||||
|
||||
+5
-256
@@ -8,14 +8,11 @@
|
||||
# terms of the GNU General Public License, version 2.
|
||||
# See the 'LICENSE' file for more details.
|
||||
#
|
||||
# -DPC_DOS -> use DOS specific code (eg:textmode stuff)...
|
||||
# -DLINUX -> use for the GNU/Linux specific
|
||||
# -D_WINDOWS -> use for the Win32/DirectX specific
|
||||
# -DHAVE_SDL -> use for the SDL interface
|
||||
#
|
||||
# Sets:
|
||||
# Compile the DGJPP/DOS version with 'make WATTCP=1'
|
||||
# Compile the DirectX/Mingw version with 'make MINGW=1'
|
||||
# Compile the Mingw version with 'make MINGW=1'
|
||||
# Compile the SDL/Mingw version with 'make MINGW=1 SDL=1'
|
||||
# Compile the SDL/Linux version with 'make LINUX=1'
|
||||
# Compile the SDL/Solaris version with 'make SOLARIS=1'
|
||||
@@ -62,7 +59,6 @@
|
||||
# Compile a debug version, add 'DEBUGMODE=1'
|
||||
# Compile with less warnings, add 'RELAXWARNINGS=1'
|
||||
# Generate compiler errors for most compiler warnings, add 'ERRORMODE=1'
|
||||
# Compile without NASM's tmap.nas, add 'NOASM=1'
|
||||
# Compile without 3D hardware support, add 'NOHW=1'
|
||||
# Compile with GDBstubs, add 'RDB=1'
|
||||
# Compile without PNG, add 'NOPNG=1'
|
||||
@@ -88,7 +84,6 @@ ALL_SYSTEMS=\
|
||||
MINGW64\
|
||||
HAIKU\
|
||||
DUMMY\
|
||||
DJGPPDOS\
|
||||
MINGW\
|
||||
UNIX\
|
||||
LINUX\
|
||||
@@ -149,10 +144,6 @@ D_FILES=$(D_DIR)/srb2.srb \
|
||||
|
||||
PKG_CONFIG?=pkg-config
|
||||
|
||||
ifdef WIILINUX
|
||||
LINUX=1
|
||||
endif
|
||||
|
||||
ifdef PANDORA
|
||||
LINUX=1
|
||||
endif
|
||||
@@ -166,7 +157,6 @@ endif
|
||||
ifdef MINGW64
|
||||
MINGW=1
|
||||
NONX86=1
|
||||
NOASM=1
|
||||
# MINGW64 should not necessarily imply X86_64=1, but we make that assumption elsewhere
|
||||
# Once that changes, remove this
|
||||
X86_64=1
|
||||
@@ -176,12 +166,6 @@ ifdef HAIKU
|
||||
SDL=1
|
||||
endif
|
||||
|
||||
ifdef NDS
|
||||
# Include this before the main Makefile.cfg
|
||||
EXENAME?=srb2.elf
|
||||
include nds/Makefile.cfg
|
||||
endif
|
||||
|
||||
include Makefile.cfg
|
||||
|
||||
ifdef DUMMY
|
||||
@@ -189,7 +173,6 @@ NOPNG=1
|
||||
NOZLIB=1
|
||||
NONET=1
|
||||
NOHW=1
|
||||
NOASM=1
|
||||
NOIPX=1
|
||||
EXENAME?=srb2dummy
|
||||
OBJS=$(OBJDIR)/i_video.o
|
||||
@@ -198,7 +181,6 @@ endif
|
||||
|
||||
ifdef HAIKU
|
||||
NOIPX=1
|
||||
NOASM=1
|
||||
ifndef NONET
|
||||
LIBS=-lnetwork
|
||||
endif
|
||||
@@ -207,35 +189,11 @@ PNG_CFLAGS?=
|
||||
PNG_LDFLAGS?=-lpng
|
||||
endif
|
||||
|
||||
ifdef WIILINUX
|
||||
NONX86=1
|
||||
NOTERMIOS=1
|
||||
NOHW=1
|
||||
CFLAGS+=-DWMINPUT
|
||||
NOTERMIOS=1
|
||||
NOPOSTPROCESSING=1
|
||||
endif
|
||||
|
||||
ifdef PANDORA
|
||||
NONX86=1
|
||||
NOHW=1
|
||||
endif
|
||||
|
||||
ifdef WII
|
||||
NONX86=1
|
||||
NOHW=1
|
||||
NOPOSTPROCESSING=1
|
||||
endif
|
||||
|
||||
ifdef PS3N
|
||||
NONX86=1
|
||||
NOHW=1
|
||||
endif
|
||||
|
||||
ifdef DJGPPDOS
|
||||
include djgppdos/Makefile.cfg
|
||||
endif
|
||||
|
||||
ifndef NOOPENMPT
|
||||
HAVE_OPENMPT=1
|
||||
endif
|
||||
@@ -267,26 +225,8 @@ ifdef MACOSX
|
||||
UNIXCOMMON=1
|
||||
endif
|
||||
|
||||
ifdef NDS
|
||||
NOPNG=1
|
||||
NOZLIB=1
|
||||
NONET=1
|
||||
#NOHW=1
|
||||
NOASM=1
|
||||
NOIPX=1
|
||||
NONX86=1
|
||||
OBJS+=$(OBJDIR)/i_video.o
|
||||
LIBS+=-lm
|
||||
endif
|
||||
|
||||
ifdef SDL
|
||||
#SDL 2.0
|
||||
ifndef SDL12
|
||||
include sdl/Makefile.cfg
|
||||
#SDL 1.2
|
||||
else
|
||||
include sdl12/Makefile.cfg
|
||||
endif #ifndef SDL12
|
||||
endif #ifdef SDL
|
||||
|
||||
ifdef DISTCC
|
||||
@@ -300,7 +240,6 @@ endif
|
||||
MSGFMT?=msgfmt
|
||||
|
||||
ifndef ECHO
|
||||
NASM:=@$(NASM)
|
||||
REMOVE:=@$(REMOVE)
|
||||
CC:=@$(CC)
|
||||
CXX:=@$(CXX)
|
||||
@@ -331,10 +270,8 @@ endif
|
||||
ifdef NOHW
|
||||
OPTS+=-DNOHW
|
||||
else
|
||||
ifndef DC
|
||||
#Hurdler: not really supported and not tested recently
|
||||
#OPTS+=-DUSE_PALETTED_TEXTURE
|
||||
endif
|
||||
OPTS+=-DHWRENDER
|
||||
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o $(OBJDIR)/hw_light.o \
|
||||
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_trick.o \
|
||||
@@ -355,12 +292,6 @@ ifdef X86_64
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef NOASM
|
||||
ifndef NONX86
|
||||
OBJS+=$(OBJDIR)/tmap.o $(OBJDIR)/tmap_mmx.o
|
||||
OPTS+=-DUSEASM
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef NOPNG
|
||||
OPTS+=-DHAVE_PNG
|
||||
@@ -470,14 +401,6 @@ else
|
||||
OBJS:=$(OBJDIR)/md5.o $(OBJS)
|
||||
endif
|
||||
|
||||
ifdef FAKEDC
|
||||
OPTS+=-DDC
|
||||
endif
|
||||
|
||||
ifdef FAKEPSP
|
||||
OPTS+=-DPSP
|
||||
endif
|
||||
|
||||
ifdef NOPOSTPROCESSING
|
||||
OPTS+=-DNOPOSTPROCESSING
|
||||
endif
|
||||
@@ -511,16 +434,6 @@ else
|
||||
endif
|
||||
CFLAGS+=-g $(OPTS) $(ARCHOPTS) $(WINDRESFLAGS)
|
||||
|
||||
ifdef YASM
|
||||
ifdef STABS
|
||||
NASMOPTS?= -g stabs
|
||||
else
|
||||
NASMOPTS?= -g dwarf2
|
||||
endif
|
||||
else
|
||||
NASMOPTS?= -g
|
||||
endif
|
||||
|
||||
ifdef PROFILEMODE
|
||||
# build with profiling information
|
||||
CFLAGS+=-pg
|
||||
@@ -624,9 +537,8 @@ OBJS:=$(i_main_o) \
|
||||
$(OBJDIR)/i_tcp.o \
|
||||
$(OBJDIR)/i_time.o \
|
||||
$(OBJDIR)/lzf.o \
|
||||
$(OBJDIR)/vid_copy.o \
|
||||
$(OBJDIR)/b_bot.o \
|
||||
$(i_cdmus_o) \
|
||||
$(OBJDIR)/args.o \
|
||||
$(i_net_o) \
|
||||
$(i_system_o) \
|
||||
$(i_sound_o) \
|
||||
@@ -642,53 +554,19 @@ POS:=$(BIN)/en.mo
|
||||
OPTS+=-DGETTEXT
|
||||
endif
|
||||
|
||||
ifdef DJGPPDOS
|
||||
all: pre-build $(BIN)/$(EXENAME)
|
||||
endif
|
||||
|
||||
ifdef XBOX
|
||||
all: pre-build $(BIN)/$(BINNAME)
|
||||
endif
|
||||
|
||||
ifdef PS3N
|
||||
all: pre-build $(BIN)/$(PKGNAME)
|
||||
endif
|
||||
|
||||
ifdef WII
|
||||
all: pre-build $(BIN)/$(DOLNAME)
|
||||
endif
|
||||
|
||||
ifdef PANDORA
|
||||
all: pre-build $(BIN)/$(PNDNAME)
|
||||
endif
|
||||
|
||||
ifdef PSP
|
||||
all: pre-build $(BIN)/$(BINNAME) post-build
|
||||
endif
|
||||
|
||||
ifdef DC
|
||||
all: pre-build $(BIN)/$(BINNAME) post-build
|
||||
endif
|
||||
|
||||
ifndef DC
|
||||
ifndef PSP
|
||||
ifndef XBOX
|
||||
ifdef MINGW
|
||||
ifndef SDL
|
||||
all: pre-build $(BIN)/$(EXENAME) dll
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef SDL
|
||||
all: pre-build $(BIN)/$(EXENAME)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef NDS
|
||||
all: $(BIN)/$(EXENAME:.elf=.nds)
|
||||
endif
|
||||
|
||||
ifdef DUMMY
|
||||
all: $(BIN)/$(EXENAME)
|
||||
@@ -700,9 +578,9 @@ cleandep:
|
||||
|
||||
pre-build:
|
||||
ifdef WINDOWSHELL
|
||||
-..\comptime.bat .
|
||||
-$(.)..\comptime.bat .
|
||||
else
|
||||
-@../comptime.sh .
|
||||
-$(.)../comptime.sh .
|
||||
endif
|
||||
|
||||
clean:
|
||||
@@ -717,14 +595,8 @@ ifdef CYGWIN32
|
||||
$(REMOVE) $(OBJDIR)/*.res
|
||||
endif
|
||||
|
||||
#make a big srb2.s that is the disasm of the exe (dos only ?)
|
||||
asm:
|
||||
$(CC) $(LDFLAGS) $(OBJS) -o $(OBJDIR)/tmp.exe $(LIBS)
|
||||
$(OBJDUMP) -d $(OBJDIR)/tmp.exe --no-show-raw-insn > srb2.s
|
||||
$(REMOVE) $(OBJDIR)/tmp.exe
|
||||
|
||||
# executable
|
||||
# NOTE: DJGPP's objcopy do not have --add-gnu-debuglink
|
||||
|
||||
$(BIN)/$(EXENAME): $(POS) $(OBJS)
|
||||
-$(MKDIR) $(BIN)
|
||||
@@ -742,12 +614,10 @@ endif
|
||||
|
||||
# mac os x lsdlsrb2 does not like objcopy
|
||||
ifndef MACOSX
|
||||
ifndef PSP
|
||||
$(OBJCOPY) $(BIN)/$(EXENAME) $(BIN)/$(DBGNAME)
|
||||
$(OBJCOPY) --strip-debug $(BIN)/$(EXENAME)
|
||||
-$(OBJCOPY) --add-gnu-debuglink=$(BIN)/$(DBGNAME) $(BIN)/$(EXENAME)
|
||||
endif
|
||||
endif
|
||||
ifndef NOUPX
|
||||
-$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME)
|
||||
endif
|
||||
@@ -772,7 +642,7 @@ else
|
||||
dll : opengl_dll
|
||||
endif
|
||||
ifdef MINGW
|
||||
all_dll: opengl_dll minigl_dll ds3d_dll fmod_dll openal_dll
|
||||
all_dll: opengl_dll ds3d_dll fmod_dll openal_dll
|
||||
|
||||
opengl_dll: $(BIN)/r_opengl.dll
|
||||
$(BIN)/r_opengl.dll: $(OBJDIR)/ogl_win.o $(OBJDIR)/r_opengl.o
|
||||
@@ -783,12 +653,6 @@ ifndef NOUPX
|
||||
-$(UPX) $(UPX_OPTS) $@
|
||||
endif
|
||||
|
||||
minigl_dll: $(BIN)/r_minigl.dll
|
||||
$(BIN)/r_minigl.dll: $(OBJDIR)/r_minigl.o
|
||||
-$(MKDIR) $(BIN)
|
||||
@echo Linking R_MiniGL.dll...
|
||||
$(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lgdi32
|
||||
|
||||
ds3d_dll: $(BIN)/s_ds3d.dll
|
||||
$(BIN)/s_ds3d.dll: $(OBJDIR)/s_ds3d.o
|
||||
@echo Linking S_DS3d.dll...
|
||||
@@ -868,16 +732,6 @@ endif
|
||||
$(REMOVE) $(OBJDIR)/depend.ped
|
||||
@echo "Created dependency file, depend.dep"
|
||||
|
||||
ifdef DC
|
||||
$(OBJDIR)/v_video.o: v_video.c doomdef.h doomtype.h g_state.h m_swap.h r_local.h \
|
||||
tables.h m_fixed.h screen.h command.h m_bbox.h r_main.h d_player.h \
|
||||
p_pspr.h info.h d_think.h sounds.h p_mobj.h doomdata.h d_ticcmd.h \
|
||||
r_data.h r_defs.h r_state.h r_bsp.h r_segs.h r_plane.h r_sky.h \
|
||||
r_things.h r_draw.h v_video.h hu_stuff.h d_event.h w_wad.h console.h \
|
||||
i_video.h z_zone.h doomstat.h d_clisrv.h d_netcmd.h
|
||||
$(CC) $(CFLAGS) -fno-omit-frame-pointer $(WFLAGS) -c $< -o $@
|
||||
endif
|
||||
|
||||
ifdef VALGRIND
|
||||
$(OBJDIR)/z_zone.o: z_zone.c
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -DHAVE_VALGRIND $(VALGRIND_CFLAGS) -c $< -o $@
|
||||
@@ -907,117 +761,12 @@ $(OBJDIR)/%.o: hardware/%.c
|
||||
$(OBJDIR)/%.o: blua/%.c
|
||||
$(CC) $(CFLAGS) $(LUA_CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJDIR)/%.o: %.nas
|
||||
$(NASM) $(NASMOPTS) -o $@ -f $(NASMFORMAT) $<
|
||||
|
||||
$(OBJDIR)/vid_copy.o: vid_copy.s asm_defs.inc
|
||||
$(CC) $(OPTS) $(ASFLAGS) -x assembler-with-cpp -c $< -o $@
|
||||
|
||||
$(OBJDIR)/%.o: %.s
|
||||
$(CC) $(OPTS) -x assembler-with-cpp -c $< -o $@
|
||||
|
||||
$(OBJDIR)/SRB2.res: win32/Srb2win.rc win32/afxres.h win32/resource.h
|
||||
$(WINDRES) -i $< -O rc $(WINDRESFLAGS) --include-dir=win32 -o $@ -O coff
|
||||
|
||||
ifdef DC
|
||||
$(OBJDIR)/romdisk.img:
|
||||
$(KOS_GENROMFS) -f romdisk.img -d ../data -v
|
||||
|
||||
$(OBJDIR)/romdisk.o: romdisk.img
|
||||
$(KOS_BASE)/utils/bin2o/bin2o romdisk.img romdisk romdisk.o
|
||||
|
||||
$(OBJDIR)/dchelp.o: $(INTERFACE)/SRB2DC/dchelp.c
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJDIR)/i_udp.o: $(INTERFACE)/SRB2DC/i_udp.c
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
|
||||
$(BIN)/IP.BIN: $(INTERFACE)/SRB2DC/IP.BIN
|
||||
$(CP) $< $@
|
||||
|
||||
$(BIN)/SRB2DC.cdi.pass1: $(INTERFACE)/SRB2DC/SELFBOOT.BIN
|
||||
$(CP) $< $@
|
||||
|
||||
$(BIN)/$(BINNAME): $(BIN)/$(EXENAME)
|
||||
$(KOS_OBJCOPY) -R .stack -O binary $< $@
|
||||
|
||||
$(BIN)/1ST_READ.BIN: $(BIN)/$(BINNAME) $(BIN)/scramble
|
||||
$(BIN)/scramble $< $@
|
||||
|
||||
$(BIN)/scramble: $(INTERFACE)/SRB2DC/scramble.c
|
||||
-$(MKDIR) $(BIN)
|
||||
$(HOSTCC) $< -o $@
|
||||
|
||||
iso: $(BIN)/SRB2DC.iso
|
||||
cdi: $(BIN)/SRB2DC.cdi
|
||||
|
||||
$(BIN)/SRB2DC.iso.pass1: $(BIN)/1ST_READ.BIN $(BIN)/IP.BIN
|
||||
-$(MKDIR) $(BIN)/cdrom
|
||||
$(CP) $(BIN)/1ST_READ.BIN $(D_FILES) $(BIN)/cdrom
|
||||
$(MKISOFS) -l -r -o $@ $(BIN)/cdrom
|
||||
|
||||
$(BIN)/SRB2DC.iso.pass2: $(BIN)/SRB2DC.iso.pass1
|
||||
$(DD) if=$< of=$@ bs=2048 skip=16 status=noxfer
|
||||
|
||||
$(BIN)/SRB2DC.iso: $(BIN)/SRB2DC.iso.pass2 $(BIN)/IP.BIN
|
||||
@cat $(BIN)/IP.BIN $(BIN)/SRB2DC.iso.pass2 > $@
|
||||
|
||||
$(BIN)/SRB2DC.cdi: $(BIN)/SRB2DC.iso.pass2 $(BIN)/SRB2DC.cdi.pass1 $(BIN)/IP.BIN
|
||||
@cat $(BIN)/SRB2DC.cdi.pass1 $(BIN)/IP.BIN $(BIN)/SRB2DC.iso.pass2 > $@
|
||||
|
||||
post-build: $(BIN)/1ST_READ.BIN
|
||||
endif
|
||||
|
||||
ifdef XBOX
|
||||
$(OBJDIR)/xboxhelp.o: $(INTERFACE)/SRB2XBOX/xboxhelp.c
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
|
||||
$(BIN)/$(BINNAME): $(BIN)/$(EXENAME)
|
||||
$(CXBE) -OUT:"$@" -DUMPINFO:"$(BIN)/SRB2XBOX.cxbe" -TITLE:"Sonic Robo Blast 2" $<
|
||||
endif
|
||||
|
||||
ifdef NDS
|
||||
$(BIN)/$(EXENAME:.elf=.nds): $(BIN)/$(EXENAME:.elf=.arm9)
|
||||
$(NDSTOOL) -c $@ -9 $(BIN)/$(EXENAME:.elf=.arm9)
|
||||
|
||||
%.arm9: %.elf
|
||||
$(OBJCOPY) -O binary $< $@
|
||||
endif
|
||||
|
||||
ifdef MINGW
|
||||
ifndef SDL
|
||||
ifndef NOHW
|
||||
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
|
||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
|
||||
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
|
||||
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
|
||||
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
|
||||
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
|
||||
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
|
||||
|
||||
$(OBJDIR)/ogl_win.o: hardware/r_opengl/ogl_win.c hardware/r_opengl/r_opengl.h \
|
||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
|
||||
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
|
||||
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
|
||||
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
|
||||
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
|
||||
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
|
||||
|
||||
$(OBJDIR)/r_minigl.o: hardware/r_minigl/r_minigl.c hardware/r_opengl/r_opengl.h \
|
||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
|
||||
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
|
||||
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
|
||||
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
|
||||
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
|
||||
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
|
||||
endif
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef SDL
|
||||
|
||||
ifdef MINGW
|
||||
|
||||
+138
-153
@@ -12,29 +12,32 @@
|
||||
# to avoid a false positive with the version detection...
|
||||
|
||||
SUPPORTED_GCC_VERSIONS:=\
|
||||
101 102\
|
||||
91 92 93\
|
||||
81 82 83 84\
|
||||
71 72 73 74 75\
|
||||
61 62 63 64\
|
||||
51 52 53 54 55\
|
||||
40 41 42 43 44 45 46 47 48 49
|
||||
132 131 130 13\
|
||||
123 122 121 120 12\
|
||||
114 113 112 111 110 11\
|
||||
105 104 103 102 101 100 10\
|
||||
95 94 93 92 91 90\
|
||||
85 84 83 82 81 80\
|
||||
75 74 73 72 71 70\
|
||||
64 63 62 61 60\
|
||||
55 54 53 52 51 50\
|
||||
49 48 47 46 45 44 43 42 41 40
|
||||
|
||||
LATEST_GCC_VERSION=10.2
|
||||
LATEST_GCC_VERSION=13.2
|
||||
|
||||
# gcc or g++
|
||||
ifdef PREFIX
|
||||
CC=$(PREFIX)-gcc
|
||||
CXX=$(PREFIX)-g++
|
||||
OBJCOPY=$(PREFIX)-objcopy
|
||||
OBJDUMP=$(PREFIX)-objdump
|
||||
STRIP=$(PREFIX)-strip
|
||||
WINDRES=$(PREFIX)-windres
|
||||
CC:=$(PREFIX)-gcc
|
||||
CXX:=$(PREFIX)-g++
|
||||
OBJCOPY?=$(PREFIX)-objcopy
|
||||
OBJDUMP?=$(PREFIX)-objdump
|
||||
STRIP?=$(PREFIX)-strip
|
||||
WINDRES?=$(PREFIX)-windres
|
||||
else
|
||||
OBJCOPY=objcopy
|
||||
OBJDUMP=objdump
|
||||
STRIP=strip
|
||||
WINDRES=windres
|
||||
OBJCOPY?=objcopy
|
||||
OBJDUMP?=objdump
|
||||
STRIP?=strip
|
||||
WINDRES?=windres
|
||||
endif
|
||||
|
||||
# because Apple screws with us on this
|
||||
@@ -51,7 +54,10 @@ ifeq (,$(filter GCC%,$(.VARIABLES)))
|
||||
version:=$(shell $(CC) --version)
|
||||
# check if this is in fact GCC
|
||||
ifneq (,$(or $(findstring gcc,$(version)),$(findstring GCC,$(version))))
|
||||
version:=$(shell $(CC) -dumpversion)
|
||||
shellversion:=$(shell $(CC) -dumpversion)
|
||||
|
||||
# Try to remove "-win32"
|
||||
version:=$(subst -win32,.0,$(shellversion))
|
||||
|
||||
# Turn version into words of major, minor
|
||||
v:=$(subst ., ,$(version))
|
||||
@@ -71,11 +77,99 @@ ifeq (,$(filter GCC%,$(.VARIABLES)))
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef GCC132
|
||||
GCC131=1
|
||||
endif
|
||||
|
||||
ifdef GCC131
|
||||
GCC130=1
|
||||
endif
|
||||
|
||||
ifdef GCC13
|
||||
GCC130=1
|
||||
endif
|
||||
|
||||
ifdef GCC130
|
||||
GCC123=1
|
||||
endif
|
||||
|
||||
ifdef GCC123
|
||||
GCC122=1
|
||||
endif
|
||||
|
||||
ifdef GCC122
|
||||
GCC121=1
|
||||
endif
|
||||
|
||||
ifdef GCC121
|
||||
GCC120=1
|
||||
endif
|
||||
|
||||
ifdef GCC12
|
||||
GCC120=1
|
||||
endif
|
||||
|
||||
ifdef GCC120
|
||||
GCC114=1
|
||||
endif
|
||||
|
||||
ifdef GCC114
|
||||
GCC113=1
|
||||
endif
|
||||
|
||||
ifdef GCC113
|
||||
GCC112=1
|
||||
endif
|
||||
|
||||
ifdef GCC112
|
||||
GCC111=1
|
||||
endif
|
||||
|
||||
ifdef GCC111
|
||||
GCC110=1
|
||||
endif
|
||||
|
||||
ifdef GCC11
|
||||
GCC110=1
|
||||
endif
|
||||
|
||||
ifdef GCC110
|
||||
GCC105=1
|
||||
endif
|
||||
|
||||
ifdef GCC105
|
||||
GCC104=1
|
||||
endif
|
||||
|
||||
ifdef GCC104
|
||||
GCC103=1
|
||||
endif
|
||||
|
||||
ifdef GCC103
|
||||
GCC102=1
|
||||
endif
|
||||
|
||||
ifdef GCC102
|
||||
GCC101=1
|
||||
endif
|
||||
|
||||
ifdef GCC101
|
||||
GCC100=1
|
||||
endif
|
||||
|
||||
ifdef GCC10
|
||||
GCC100=1
|
||||
endif
|
||||
|
||||
ifdef GCC100
|
||||
GCC93=1
|
||||
endif
|
||||
|
||||
ifdef GCC95
|
||||
GCC94=1
|
||||
endif
|
||||
|
||||
ifdef GCC94
|
||||
GCC93=1
|
||||
endif
|
||||
|
||||
@@ -88,6 +182,14 @@ GCC91=1
|
||||
endif
|
||||
|
||||
ifdef GCC91
|
||||
GCC90=1
|
||||
endif
|
||||
|
||||
ifdef GCC90
|
||||
GCC85=1
|
||||
endif
|
||||
|
||||
ifdef GCC85
|
||||
GCC84=1
|
||||
endif
|
||||
|
||||
@@ -104,6 +206,10 @@ GCC81=1
|
||||
endif
|
||||
|
||||
ifdef GCC81
|
||||
GCC80=1
|
||||
endif
|
||||
|
||||
ifdef GCC80
|
||||
GCC75=1
|
||||
endif
|
||||
|
||||
@@ -124,6 +230,10 @@ GCC71=1
|
||||
endif
|
||||
|
||||
ifdef GCC71
|
||||
GCC70=1
|
||||
endif
|
||||
|
||||
ifdef GCC70
|
||||
GCC64=1
|
||||
endif
|
||||
|
||||
@@ -140,6 +250,10 @@ GCC61=1
|
||||
endif
|
||||
|
||||
ifdef GCC61
|
||||
GCC60=1
|
||||
endif
|
||||
|
||||
ifdef GCC60
|
||||
GCC55=1
|
||||
endif
|
||||
|
||||
@@ -160,6 +274,10 @@ GCC51=1
|
||||
endif
|
||||
|
||||
ifdef GCC51
|
||||
GCC50=1
|
||||
endif
|
||||
|
||||
ifdef GCC50
|
||||
GCC49=1
|
||||
endif
|
||||
|
||||
@@ -204,10 +322,6 @@ ifdef GCC295
|
||||
GCC29=1
|
||||
endif
|
||||
|
||||
ifdef DC
|
||||
NOCASTALIGNWARN=1
|
||||
endif
|
||||
|
||||
OLDWFLAGS:=$(WFLAGS)
|
||||
# -W -Wno-unused
|
||||
WFLAGS=-Wall
|
||||
@@ -264,15 +378,11 @@ endif
|
||||
ifdef GCC40
|
||||
WFLAGS+=-Wold-style-definition
|
||||
endif
|
||||
ifndef XBOX
|
||||
WFLAGS+=-Wmissing-prototypes -Wmissing-declarations
|
||||
endif
|
||||
ifdef GCC40
|
||||
WFLAGS+=-Wmissing-field-initializers
|
||||
endif
|
||||
ifndef XBOX
|
||||
WFLAGS+=-Wmissing-noreturn
|
||||
endif
|
||||
#WFLAGS+=-Wmissing-format-attribute
|
||||
#WFLAGS+=-Wno-multichar
|
||||
#WFLAGS+=-Wno-deprecated-declarations
|
||||
@@ -344,28 +454,14 @@ endif
|
||||
|
||||
|
||||
#indicate platform and what interface use with
|
||||
ifndef WINCE
|
||||
ifndef XBOX
|
||||
ifndef PSP
|
||||
ifndef DC
|
||||
ifndef WII
|
||||
ifndef PS3N
|
||||
ifndef LINUX
|
||||
ifndef FREEBSD
|
||||
ifndef CYGWIN32
|
||||
ifndef MINGW
|
||||
ifndef MINGW64
|
||||
ifndef SDL
|
||||
ifndef NDS
|
||||
ifndef DUMMY
|
||||
DJGPPDOS=1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
$(error No interface or platform flag defined)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
@@ -375,7 +471,6 @@ endif
|
||||
endif
|
||||
|
||||
#determine the interface directory (where you put all i_*.c)
|
||||
i_cdmus_o=$(OBJDIR)/i_cdmus.o
|
||||
i_net_o=$(OBJDIR)/i_net.o
|
||||
i_system_o=$(OBJDIR)/i_system.o
|
||||
i_sound_o=$(OBJDIR)/i_sound.o
|
||||
@@ -383,12 +478,6 @@ i_main_o=$(OBJDIR)/i_main.o
|
||||
#set OBJDIR and BIN's starting place
|
||||
OBJDIR=../objs
|
||||
BIN=../bin
|
||||
#Nasm ASM and rm
|
||||
ifdef YASM
|
||||
NASM?=yasm
|
||||
else
|
||||
NASM?=nasm
|
||||
endif
|
||||
REMOVE?=rm -f
|
||||
CP?=cp
|
||||
MKDIR?=mkdir -p
|
||||
@@ -404,23 +493,12 @@ UPX_OPTS+=-q
|
||||
endif
|
||||
|
||||
#Interface Setup
|
||||
ifdef DJGPPDOS
|
||||
INTERFACE=djgppdos
|
||||
NASMFORMAT=coff
|
||||
OBJDIR:=$(OBJDIR)/djgppdos
|
||||
ifdef WATTCP
|
||||
OBJDIR:=$(OBJDIR)/wattcp
|
||||
endif
|
||||
WFLAGS+=-Wno-format
|
||||
BIN:=$(BIN)/Dos
|
||||
else
|
||||
ifdef DUMMY
|
||||
INTERFACE=dummy
|
||||
OBJDIR:=$(OBJDIR)/dummy
|
||||
BIN:=$(BIN)/dummy
|
||||
else
|
||||
ifdef LINUX
|
||||
NASMFORMAT=elf -DLINUX
|
||||
SDL=1
|
||||
ifdef LINUX64
|
||||
OBJDIR:=$(OBJDIR)/Linux64
|
||||
@@ -432,7 +510,6 @@ endif
|
||||
else
|
||||
ifdef FREEBSD
|
||||
INTERFACE=sdl
|
||||
NASMFORMAT=elf -DLINUX
|
||||
SDL=1
|
||||
|
||||
OBJDIR:=$(OBJDIR)/FreeBSD
|
||||
@@ -440,7 +517,6 @@ ifdef FREEBSD
|
||||
else
|
||||
ifdef SOLARIS
|
||||
INTERFACE=sdl
|
||||
NASMFORMAT=elf -DLINUX
|
||||
SDL=1
|
||||
|
||||
OBJDIR:=$(OBJDIR)/Solaris
|
||||
@@ -448,7 +524,6 @@ ifdef SOLARIS
|
||||
else
|
||||
ifdef CYGWIN32
|
||||
INTERFACE=sdl
|
||||
NASMFORMAT=win32
|
||||
SDL=1
|
||||
|
||||
OBJDIR:=$(OBJDIR)/cygwin
|
||||
@@ -456,83 +531,13 @@ ifdef CYGWIN32
|
||||
else
|
||||
ifdef MINGW64
|
||||
INTERFACE=win32
|
||||
#NASMFORMAT=win64
|
||||
OBJDIR:=$(OBJDIR)/Mingw64
|
||||
BIN:=$(BIN)/Mingw64
|
||||
else
|
||||
ifdef WII
|
||||
INTERFACE=sdl12
|
||||
NONX86=1
|
||||
STATIC=1
|
||||
PREFIX?=powerpc-eabi
|
||||
SDL=1
|
||||
SDL12=1
|
||||
SDLMAIN=1
|
||||
OBJDIR:=$(OBJDIR)/Wii
|
||||
BIN:=$(BIN)/Wii
|
||||
NOUPX=1
|
||||
else
|
||||
ifdef PS3N
|
||||
INTERFACE=sdl12
|
||||
NONX86=1
|
||||
STATIC=1
|
||||
PREFIX?=ppu
|
||||
SDL=1
|
||||
SDL12=1
|
||||
# unsure?
|
||||
#SDLMAIN=1
|
||||
# can't compile SDL_mixer for ps3...
|
||||
NOMIXER=1
|
||||
OBJDIR:=$(OBJDIR)/PS3
|
||||
BIN:=$(BIN)/PS3
|
||||
else
|
||||
ifdef MINGW
|
||||
INTERFACE=win32
|
||||
NASMFORMAT=win32
|
||||
OBJDIR:=$(OBJDIR)/Mingw
|
||||
BIN:=$(BIN)/Mingw
|
||||
else
|
||||
ifdef XBOX
|
||||
INTERFACE=sdl12
|
||||
NASMFORMAT=win32
|
||||
PREFIX?=/usr/local/openxdk/bin/i386-pc-xbox
|
||||
SDL=1
|
||||
SDL12=1
|
||||
OBJDIR:=$(OBJDIR)/XBOX
|
||||
BIN:=$(BIN)/XBOX
|
||||
else
|
||||
ifdef PSP
|
||||
INTERFACE=sdl12
|
||||
NONX86=1
|
||||
SDL=1
|
||||
SDL12=1
|
||||
OBJDIR:=$(OBJDIR)/PSP
|
||||
BIN:=$(BIN)/PSP
|
||||
NOUPX=1
|
||||
else
|
||||
ifdef DC
|
||||
INTERFACE=sdl12
|
||||
NONX86=1
|
||||
SDL=1
|
||||
SDL12=1
|
||||
OBJDIR:=$(OBJDIR)/DC
|
||||
BIN:=$(BIN)/DC
|
||||
NOUPX=1
|
||||
else
|
||||
ifdef WINCE
|
||||
INTERFACE=sdl12
|
||||
NONX86=1
|
||||
PREFIX?=arm-wince-pe
|
||||
SDL=1
|
||||
SDL12=1
|
||||
OBJDIR:=$(OBJDIR)/WinCE
|
||||
BIN:=$(BIN)/WinCE
|
||||
else
|
||||
ifdef NDS
|
||||
INTERFACE=nds
|
||||
OBJDIR:=$(OBJDIR)/nds
|
||||
BIN:=$(BIN)/nds
|
||||
NOUPX=1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
@@ -540,20 +545,6 @@ endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef GP2X
|
||||
ifdef SDL
|
||||
SDL12=1
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef ARCHNAME
|
||||
OBJDIR:=$(OBJDIR)/$(ARCHNAME)
|
||||
@@ -564,13 +555,7 @@ OBJDUMP_OPTS?=--wide --source --line-numbers
|
||||
LD=$(CC)
|
||||
|
||||
ifdef SDL
|
||||
# SDL 2.0
|
||||
ifndef SDL12
|
||||
INTERFACE=sdl
|
||||
# SDL 1.2
|
||||
else
|
||||
INTERFACE=sdl12
|
||||
endif
|
||||
OBJDIR:=$(OBJDIR)/SDL
|
||||
endif
|
||||
|
||||
|
||||
@@ -42,11 +42,6 @@ static const UINT8 NOCLIMBGRAYS = 204;
|
||||
static const UINT8 NOCLIMBBROWNS = (2*16);
|
||||
static const UINT8 NOCLIMBYELLOWS = (11*16);
|
||||
|
||||
|
||||
#ifdef _NDS
|
||||
#undef BACKGROUND
|
||||
#endif
|
||||
|
||||
// Automap colors
|
||||
#define BACKGROUND DBLACK
|
||||
#define WALLCOLORS (REDS + REDRANGE/2)
|
||||
|
||||
@@ -24,7 +24,7 @@ static INT64 start_time; // as microseconds since the epoch
|
||||
|
||||
// I should probably return how much memory is remaining
|
||||
// for this process, considering Android's process memory limit.
|
||||
UINT32 I_GetFreeMem(UINT32 *total)
|
||||
size_t I_GetFreeMem(size_t *total)
|
||||
{
|
||||
// what the heck? sysinfo() is partially missing in bionic?
|
||||
/* struct sysinfo si; */
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file asm_defs.inc
|
||||
/// \brief must match the C structures
|
||||
|
||||
#ifndef __ASM_DEFS__
|
||||
#define __ASM_DEFS__
|
||||
|
||||
// this makes variables more noticable,
|
||||
// and make the label match with C code
|
||||
|
||||
// Linux, unlike DOS, has no "_" 19990119 by Kin
|
||||
// and nasm needs .data code segs under linux 20010210 by metzgermeister
|
||||
// FIXME: nasm ignores these settings, so I put the macros into the makefile
|
||||
#ifdef __ELF__
|
||||
#define C(label) label
|
||||
#define CODE_SEG .data
|
||||
#else
|
||||
#define C(label) _##label
|
||||
#define CODE_SEG .text
|
||||
#endif
|
||||
|
||||
/* This is a more readable way to access the arguments passed from C code */
|
||||
/* PLEASE NOTE: it is supposed that all arguments passed from C code are */
|
||||
/* 32bit integer (INT32, long, and most *pointers) */
|
||||
#define ARG1 8(%ebp)
|
||||
#define ARG2 12(%ebp)
|
||||
#define ARG3 16(%ebp)
|
||||
#define ARG4 20(%ebp)
|
||||
#define ARG5 24(%ebp)
|
||||
#define ARG6 28(%ebp)
|
||||
#define ARG7 32(%ebp)
|
||||
#define ARG8 36(%ebp)
|
||||
#define ARG9 40(%ebp) //(c)tm ... Allegro by Shawn Hargreaves.
|
||||
|
||||
#endif
|
||||
+11
-12
@@ -686,6 +686,15 @@ static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) {
|
||||
}
|
||||
|
||||
|
||||
static void codeunaryarith (FuncState *fs, OpCode op, expdesc *e) {
|
||||
expdesc e2;
|
||||
e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0;
|
||||
if (!isnumeral(e))
|
||||
luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */
|
||||
codearith(fs, op, e, &e2);
|
||||
}
|
||||
|
||||
|
||||
static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1,
|
||||
expdesc *e2) {
|
||||
int o1 = luaK_exp2RK(fs, e1);
|
||||
@@ -706,18 +715,8 @@ void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) {
|
||||
expdesc e2;
|
||||
e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0;
|
||||
switch (op) {
|
||||
case OPR_MINUS: {
|
||||
if (!isnumeral(e))
|
||||
luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */
|
||||
codearith(fs, OP_UNM, e, &e2);
|
||||
break;
|
||||
}
|
||||
case OPR_BNOT: {
|
||||
if (e->k == VK)
|
||||
luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */
|
||||
codearith(fs, OP_BNOT, e, &e2);
|
||||
break;
|
||||
}
|
||||
case OPR_MINUS: codeunaryarith(fs, OP_UNM, e); break;
|
||||
case OPR_BNOT: codeunaryarith(fs, OP_BNOT, e); break;
|
||||
case OPR_NOT: codenot(fs, e); break;
|
||||
case OPR_LEN: {
|
||||
luaK_exp2anyreg(fs, e); /* cannot operate on constants */
|
||||
|
||||
@@ -445,7 +445,6 @@ static int io_readline (lua_State *L) {
|
||||
static int g_write (lua_State *L, FILE *f, int arg) {
|
||||
int nargs = lua_gettop(L) - 1;
|
||||
int status = 1;
|
||||
size_t count;
|
||||
for (; nargs--; arg++) {
|
||||
if (lua_type(L, arg) == LUA_TNUMBER) {
|
||||
/* optimization: could be done exactly as for strings */
|
||||
@@ -455,7 +454,6 @@ static int g_write (lua_State *L, FILE *f, int arg) {
|
||||
else {
|
||||
size_t l;
|
||||
const char *s = luaL_checklstring(L, arg, &l);
|
||||
count += l;
|
||||
if (ftell(f) + l > FILELIMIT)
|
||||
{
|
||||
luaL_error(L,"write limit bypassed in file. Changes have been discarded.");
|
||||
|
||||
+13
-6
@@ -277,7 +277,7 @@ static xcommand_t *com_commands = NULL; // current commands
|
||||
|
||||
#define MAX_ARGS 80
|
||||
static size_t com_argc;
|
||||
static char *com_argv[MAX_ARGS];
|
||||
char *com_argv[MAX_ARGS];
|
||||
static const char *com_null_string = "";
|
||||
static char *com_args = NULL; // current command args or NULL
|
||||
|
||||
@@ -327,6 +327,16 @@ const char *COM_Argv(size_t arg)
|
||||
return com_argv[arg];
|
||||
}
|
||||
|
||||
/** Returns all of the console command arguments
|
||||
*
|
||||
* \return String pointer to the argv table.
|
||||
* \sa COM_ArgvList
|
||||
*/
|
||||
char **COM_ArgvList(void)
|
||||
{
|
||||
return com_argv;
|
||||
}
|
||||
|
||||
/** Gets all console command arguments.
|
||||
*
|
||||
* \return String pointer to all arguments for the last command.
|
||||
@@ -1445,7 +1455,7 @@ static void Got_NetVar(UINT8 **p, INT32 playernum)
|
||||
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -1464,9 +1474,6 @@ static void Got_NetVar(UINT8 **p, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, "Netvar not found with netid %hu\n", netid);
|
||||
return;
|
||||
}
|
||||
#if 0 //defined (GP2X) || defined (PSP)
|
||||
CONS_Printf("Netvar received: %s [netid=%d] value %s\n", cvar->name, netid, svalue);
|
||||
#endif
|
||||
DEBFILE(va("Netvar received: %s [netid=%d] value %s\n", cvar->name, netid, svalue));
|
||||
|
||||
Setvalue(cvar, svalue, stealth);
|
||||
@@ -1587,7 +1594,7 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
|
||||
if (var->flags & CV_NETVAR)
|
||||
{
|
||||
// send the value of the variable
|
||||
XBOXSTATIC UINT8 buf[128];
|
||||
UINT8 buf[128];
|
||||
UINT8 *p = buf;
|
||||
if (!(server || (IsPlayerAdmin(consoleplayer))))
|
||||
{
|
||||
|
||||
@@ -33,8 +33,12 @@ typedef void (*com_func_t)(void);
|
||||
void COM_AddCommand(const char *name, com_func_t func);
|
||||
int COM_AddLuaCommand(const char *name);
|
||||
|
||||
#define MAX_ARGS 80
|
||||
extern char *com_argv[MAX_ARGS];
|
||||
|
||||
size_t COM_Argc(void);
|
||||
const char *COM_Argv(size_t arg); // if argv > argc, returns empty string
|
||||
char **COM_ArgvList(void);
|
||||
char *COM_Args(void);
|
||||
size_t COM_CheckParm(const char *check); // like M_CheckParm :)
|
||||
size_t COM_CheckPartialParm(const char *check);
|
||||
|
||||
+35
-60
@@ -12,9 +12,6 @@
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <unistd.h>
|
||||
#ifdef _XBOX
|
||||
#include <openxdk/debug.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "doomdef.h"
|
||||
@@ -23,6 +20,7 @@
|
||||
#include "g_input.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "keys.h"
|
||||
#include "r_main.h"
|
||||
#include "r_defs.h"
|
||||
#include "sounds.h"
|
||||
#include "st_stuff.h"
|
||||
@@ -36,10 +34,6 @@
|
||||
#include "m_menu.h"
|
||||
#include "filesrch.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include "win32/win_main.h"
|
||||
#endif
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h"
|
||||
#endif
|
||||
@@ -374,14 +368,10 @@ static void CON_SetupColormaps(void)
|
||||
CON_SetupBackColormap();
|
||||
}
|
||||
|
||||
//
|
||||
// Setup the console text buffer
|
||||
//
|
||||
// for WII, libogc already has a CON_Init function, we must rename it here
|
||||
#ifdef _WII
|
||||
void CON_InitWii(void)
|
||||
#else
|
||||
void CON_Init(void)
|
||||
#endif
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
@@ -456,6 +446,8 @@ void CON_Init(void)
|
||||
Unlock_state();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Console input initialization
|
||||
//
|
||||
static void CON_InputInit(void)
|
||||
@@ -602,32 +594,38 @@ static void CON_ChangeHeight(void)
|
||||
//
|
||||
static void CON_MoveConsole(void)
|
||||
{
|
||||
fixed_t conspeed;
|
||||
static fixed_t fracmovement = 0;
|
||||
|
||||
Lock_state();
|
||||
|
||||
conspeed = FixedDiv(cons_speed.value*vid.fdupy, FRACUNIT);
|
||||
|
||||
// instant
|
||||
if (!cons_speed.value)
|
||||
{
|
||||
con_curlines = con_destlines;
|
||||
Unlock_state();
|
||||
return;
|
||||
}
|
||||
|
||||
// up/down move to dest
|
||||
if (con_curlines < con_destlines)
|
||||
// Not instant - Increment fracmovement fractionally
|
||||
fracmovement += FixedMul(cons_speed.value*vid.fdupy, renderdeltatics);
|
||||
|
||||
if (con_curlines < con_destlines) // Move the console downwards
|
||||
{
|
||||
con_curlines += FixedInt(conspeed);
|
||||
if (con_curlines > con_destlines)
|
||||
con_curlines = con_destlines;
|
||||
con_curlines += FixedInt(fracmovement); // Move by fracmovement's integer value
|
||||
if (con_curlines > con_destlines) // If we surpassed the destination...
|
||||
con_curlines = con_destlines; // ...clamp to it!
|
||||
}
|
||||
else if (con_curlines > con_destlines)
|
||||
else // Move the console upwards
|
||||
{
|
||||
con_curlines -= FixedInt(conspeed);
|
||||
con_curlines -= FixedInt(fracmovement);
|
||||
if (con_curlines < con_destlines)
|
||||
con_curlines = con_destlines;
|
||||
|
||||
if (con_destlines == 0) // If the console is being closed, not just moved up...
|
||||
con_tick = 0; // ...don't show the blinking cursor
|
||||
}
|
||||
|
||||
fracmovement %= FRACUNIT; // Reset fracmovement's integer value, but keep the fraction
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
@@ -724,10 +722,6 @@ void CON_Ticker(void)
|
||||
CON_ChangeHeight();
|
||||
}
|
||||
|
||||
// console movement
|
||||
if (con_destlines != con_curlines)
|
||||
CON_MoveConsole();
|
||||
|
||||
// clip the view, so that the part under the console is not drawn
|
||||
con_clipviewtop = -1;
|
||||
if (cons_backpic.value) // clip only when using an opaque background
|
||||
@@ -1148,7 +1142,10 @@ boolean CON_Responder(event_t *ev)
|
||||
|
||||
CONS_Printf("\x86""%c""\x80""%s\n", CON_PROMPTCHAR, inputlines[inputline]);
|
||||
|
||||
inputline = (inputline+1) & 31;
|
||||
// Only add command to history if it differs from previous one
|
||||
if (strcmp(inputlines[inputline], inputlines[(inputline-1) & 31]))
|
||||
inputline = (inputline+1) & 31;
|
||||
|
||||
inputhist = inputline;
|
||||
CON_InputClear();
|
||||
|
||||
@@ -1215,10 +1212,10 @@ boolean CON_Responder(event_t *ev)
|
||||
// allow people to use keypad in console (good for typing IP addresses) - Calum
|
||||
if (key >= KEY_KEYPAD7 && key <= KEY_KPADDEL)
|
||||
{
|
||||
XBOXSTATIC char keypad_translation[] = {'7','8','9','-',
|
||||
'4','5','6','+',
|
||||
'1','2','3',
|
||||
'0','.'};
|
||||
char keypad_translation[] = {'7','8','9','-',
|
||||
'4','5','6','+',
|
||||
'1','2','3',
|
||||
'0','.'};
|
||||
|
||||
key = keypad_translation[key - KEY_KEYPAD7];
|
||||
}
|
||||
@@ -1376,7 +1373,7 @@ static void CON_Print(char *msg)
|
||||
|
||||
void CON_LogMessage(const char *msg)
|
||||
{
|
||||
XBOXSTATIC char txt[8192], *t;
|
||||
char txt[8192], *t;
|
||||
const char *p = msg, *e = txt+sizeof (txt)-2;
|
||||
|
||||
for (t = txt; *p != '\0'; p++)
|
||||
@@ -1413,28 +1410,12 @@ void CONS_Printf(const char *fmt, ...)
|
||||
va_end(argptr);
|
||||
|
||||
// echo console prints to log file
|
||||
#ifndef _arch_dreamcast
|
||||
DEBFILE(txt);
|
||||
#endif
|
||||
|
||||
if (!con_started)
|
||||
{
|
||||
#if defined (_XBOX) && defined (__GNUC__)
|
||||
if (!keyboard_started) debugPrint(txt);
|
||||
#endif
|
||||
#ifdef PC_DOS
|
||||
CON_LogMessage(txt);
|
||||
free(txt);
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
// write message in con text buffer
|
||||
if (con_started)
|
||||
CON_Print(txt);
|
||||
|
||||
#ifndef PC_DOS
|
||||
|
||||
CON_LogMessage(txt);
|
||||
#endif
|
||||
|
||||
Lock_state();
|
||||
|
||||
@@ -1447,19 +1428,9 @@ void CONS_Printf(const char *fmt, ...)
|
||||
// if not in display loop, force screen update
|
||||
if (startup)
|
||||
{
|
||||
#if (defined (_WINDOWS)) || (defined (__OS2__) && !defined (HAVE_SDL))
|
||||
patch_t *con_backpic = W_CachePatchName("KARTKREW", PU_CACHE);
|
||||
|
||||
// Jimita: CON_DrawBackpic just called V_DrawScaledPatch
|
||||
V_DrawFixedPatch(0, 0, FRACUNIT/2, 0, con_backpic, NULL);
|
||||
|
||||
W_UnlockCachedPatch(con_backpic);
|
||||
I_LoadingScreen(txt); // Win32/OS2 only
|
||||
#else
|
||||
// here we display the console text
|
||||
CON_Drawer();
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1774,6 +1745,10 @@ void CON_Drawer(void)
|
||||
if (con_curlines <= 0)
|
||||
CON_ClearHUD();
|
||||
}
|
||||
|
||||
// console movement
|
||||
if (con_curlines != con_destlines)
|
||||
CON_MoveConsole();
|
||||
|
||||
if (con_curlines > 0)
|
||||
CON_DrawConsole();
|
||||
|
||||
@@ -14,11 +14,7 @@
|
||||
#include "command.h"
|
||||
#include "i_threads.h"
|
||||
|
||||
#ifdef _WII
|
||||
void CON_InitWii(void);
|
||||
#else
|
||||
void CON_Init(void);
|
||||
#endif
|
||||
|
||||
boolean CON_Responder(event_t *ev);
|
||||
|
||||
|
||||
+49
-46
@@ -10,9 +10,7 @@
|
||||
/// \file d_clisrv.c
|
||||
/// \brief SRB2 Network game communication and protocol, all OS independent parts.
|
||||
|
||||
#if !defined (UNDER_CE)
|
||||
#include <time.h>
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
#include <unistd.h> //for unlink
|
||||
#endif
|
||||
@@ -56,10 +54,6 @@
|
||||
#include "f_finale.h"
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX
|
||||
#include "sdl12/SRB2XBOX/xboxhelp.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
#include "discord.h"
|
||||
#endif
|
||||
@@ -452,7 +446,7 @@ static void ExtraDataTicker(void)
|
||||
{
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[3];
|
||||
UINT8 buf[3];
|
||||
|
||||
buf[0] = (UINT8)i;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -1073,7 +1067,7 @@ static void SV_SendResynch(INT32 node)
|
||||
|
||||
if (resynch_score[node] > (unsigned)cv_resynchattempts.value*250)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
buf[0] = (UINT8)nodetoplayer[node];
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
@@ -1833,7 +1827,7 @@ static void SV_SavedGame(void)
|
||||
{
|
||||
size_t length;
|
||||
UINT8 *savebuffer;
|
||||
XBOXSTATIC char tmpsave[264];
|
||||
char tmpsave[264];
|
||||
|
||||
if (!cv_dumpconsistency.value)
|
||||
return;
|
||||
@@ -1875,7 +1869,7 @@ static void CL_LoadReceivedSavegame(void)
|
||||
{
|
||||
UINT8 *savebuffer = NULL;
|
||||
size_t length, decompressedlen;
|
||||
XBOXSTATIC char tmpsave[264];
|
||||
char tmpsave[264];
|
||||
|
||||
sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home);
|
||||
|
||||
@@ -2639,7 +2633,7 @@ static void CL_ConnectToServer(void)
|
||||
tic_t asksent;
|
||||
#endif
|
||||
#ifdef JOININGAME
|
||||
XBOXSTATIC char tmpsave[264];
|
||||
char tmpsave[264];
|
||||
|
||||
sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home);
|
||||
#endif
|
||||
@@ -3381,7 +3375,7 @@ static void Command_Ban(void)
|
||||
|
||||
if (server || IsPlayerAdmin(consoleplayer))
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH];
|
||||
UINT8 buf[3 + MAX_REASONLENGTH];
|
||||
UINT8 *p = buf;
|
||||
const SINT8 pn = nametonum(COM_Argv(1));
|
||||
|
||||
@@ -3498,7 +3492,7 @@ static void Command_Kick(void)
|
||||
|
||||
if (server || IsPlayerAdmin(consoleplayer))
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH];
|
||||
UINT8 buf[3 + MAX_REASONLENGTH];
|
||||
UINT8 *p = buf;
|
||||
const SINT8 pn = nametonum(COM_Argv(1));
|
||||
|
||||
@@ -3550,7 +3544,7 @@ static void Command_Kick(void)
|
||||
static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||
{
|
||||
INT32 pnum, msg;
|
||||
XBOXSTATIC char buf[3 + MAX_REASONLENGTH];
|
||||
char buf[3 + MAX_REASONLENGTH];
|
||||
char *reason = buf;
|
||||
kickreason_t kickreason = KR_KICK;
|
||||
UINT32 banMinutes = 0;
|
||||
@@ -4124,7 +4118,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal add player command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -4209,7 +4203,7 @@ static void Got_RemovePlayer(UINT8 **p, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal remove player command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -4231,7 +4225,7 @@ static void Got_RemovePlayer(UINT8 **p, INT32 playernum)
|
||||
static boolean SV_AddWaitingPlayers(void)
|
||||
{
|
||||
INT32 node, n, newplayer = false;
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
UINT8 newplayernum = 0;
|
||||
|
||||
// What is the reason for this? Why can't newplayernum always be 0?
|
||||
@@ -4304,7 +4298,7 @@ void CL_AddSplitscreenPlayer(void)
|
||||
|
||||
void CL_RemoveSplitscreenPlayer(UINT8 p)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
if (cl_mode != CL_CONNECTED)
|
||||
return;
|
||||
@@ -4890,7 +4884,7 @@ static boolean CheckForSpeedHacks(UINT8 p)
|
||||
|| netcmds[maketic%TICQUEUE][p].sidemove > MAXPLMOVE || netcmds[maketic%TICQUEUE][p].sidemove < -MAXPLMOVE
|
||||
|| netcmds[maketic%TICQUEUE][p].driftturn > KART_FULLTURN || netcmds[maketic%TICQUEUE][p].driftturn < -KART_FULLTURN)
|
||||
{
|
||||
XBOXSTATIC char buf[2];
|
||||
char buf[2];
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal movement value received from node %d\n"), playernode[p]);
|
||||
//D_Clearticcmd(k);
|
||||
|
||||
@@ -4912,11 +4906,11 @@ static boolean CheckForSpeedHacks(UINT8 p)
|
||||
*
|
||||
*/
|
||||
static void HandlePacketFromPlayer(SINT8 node)
|
||||
{FILESTAMP
|
||||
XBOXSTATIC INT32 netconsole;
|
||||
XBOXSTATIC tic_t realend, realstart;
|
||||
XBOXSTATIC UINT8 *pak, *txtpak, numtxtpak;
|
||||
FILESTAMP
|
||||
{
|
||||
INT32 netconsole;
|
||||
tic_t realend, realstart;
|
||||
UINT8 *pak, *txtpak, numtxtpak;
|
||||
|
||||
|
||||
txtpak = NULL;
|
||||
|
||||
@@ -4987,26 +4981,36 @@ FILESTAMP
|
||||
/// \todo Use a separate cvar for that kind of timeout?
|
||||
freezetimeout[node] = I_GetTime() + connectiontimeout;
|
||||
|
||||
//Ported this from 2.2 Prevent dropped ticcmds due to interp timing jutter
|
||||
// If we've alredy received a ticcmd for this tic, just submit it for the next one.
|
||||
tic_t faketic = maketic;
|
||||
if ((!!(netcmds[maketic % TICQUEUE][netconsole].angleturn & TICCMD_RECEIVED))
|
||||
&& (maketic - firstticstosend < TICQUEUE - 1))
|
||||
faketic++;
|
||||
|
||||
|
||||
|
||||
// Don't do anything for packets of type NODEKEEPALIVE?
|
||||
// Sryder 2018/07/01: Update the freezetimeout still!
|
||||
if (netbuffer->packettype == PT_NODEKEEPALIVE
|
||||
|| netbuffer->packettype == PT_NODEKEEPALIVEMIS)
|
||||
break;
|
||||
|
||||
// Copy ticcmd
|
||||
G_MoveTiccmd(&netcmds[maketic%TICQUEUE][netconsole], &netbuffer->u.clientpak.cmd, 1);
|
||||
// Copy ticcmd Prevent dropped ticcmds due to interp timing jutter
|
||||
G_MoveTiccmd(&netcmds[faketic%TICQUEUE][netconsole], &netbuffer->u.clientpak.cmd, 1);
|
||||
|
||||
|
||||
// Check ticcmd for "speed hacks"
|
||||
if (CheckForSpeedHacks((UINT8)netconsole))
|
||||
break;
|
||||
|
||||
// Splitscreen cmd
|
||||
// Splitscreen cmd Prevent dropped ticcmds due to interp timing jutter
|
||||
if (((netbuffer->packettype == PT_CLIENT2CMD || netbuffer->packettype == PT_CLIENT2MIS)
|
||||
|| (netbuffer->packettype == PT_CLIENT3CMD || netbuffer->packettype == PT_CLIENT3MIS)
|
||||
|| (netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS))
|
||||
&& (nodetoplayer2[node] >= 0))
|
||||
{
|
||||
G_MoveTiccmd(&netcmds[maketic%TICQUEUE][(UINT8)nodetoplayer2[node]],
|
||||
G_MoveTiccmd(&netcmds[faketic%TICQUEUE][(UINT8)nodetoplayer2[node]],
|
||||
&netbuffer->u.client2pak.cmd2, 1);
|
||||
|
||||
if (CheckForSpeedHacks((UINT8)nodetoplayer2[node]))
|
||||
@@ -5017,7 +5021,7 @@ FILESTAMP
|
||||
|| (netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS))
|
||||
&& (nodetoplayer3[node] >= 0))
|
||||
{
|
||||
G_MoveTiccmd(&netcmds[maketic%TICQUEUE][(UINT8)nodetoplayer3[node]],
|
||||
G_MoveTiccmd(&netcmds[faketic%TICQUEUE][(UINT8)nodetoplayer3[node]],
|
||||
&netbuffer->u.client3pak.cmd3, 1);
|
||||
|
||||
if (CheckForSpeedHacks((UINT8)nodetoplayer3[node]))
|
||||
@@ -5027,7 +5031,7 @@ FILESTAMP
|
||||
if ((netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS)
|
||||
&& (nodetoplayer4[node] >= 0))
|
||||
{
|
||||
G_MoveTiccmd(&netcmds[maketic%TICQUEUE][(UINT8)nodetoplayer4[node]],
|
||||
G_MoveTiccmd(&netcmds[faketic%TICQUEUE][(UINT8)nodetoplayer4[node]],
|
||||
&netbuffer->u.client4pak.cmd4, 1);
|
||||
|
||||
if (CheckForSpeedHacks((UINT8)nodetoplayer4[node]))
|
||||
@@ -5061,7 +5065,7 @@ FILESTAMP
|
||||
}
|
||||
else
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[3];
|
||||
UINT8 buf[3];
|
||||
|
||||
buf[0] = (UINT8)netconsole;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -5174,7 +5178,7 @@ FILESTAMP
|
||||
nodewaiting[node] = 0;
|
||||
if (netconsole != -1 && playeringame[netconsole])
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
buf[0] = (UINT8)netconsole;
|
||||
if (netbuffer->packettype == PT_NODETIMEOUT)
|
||||
buf[1] = KICK_MSG_TIMEOUT;
|
||||
@@ -5219,7 +5223,7 @@ FILESTAMP
|
||||
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
buf[0] = (UINT8)node;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
@@ -5244,7 +5248,7 @@ FILESTAMP
|
||||
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
buf[0] = (UINT8)node;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
@@ -5311,7 +5315,7 @@ FILESTAMP
|
||||
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC char buf[2];
|
||||
char buf[2];
|
||||
buf[0] = (char)node;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
@@ -5330,7 +5334,7 @@ FILESTAMP
|
||||
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC char buf[2];
|
||||
char buf[2];
|
||||
buf[0] = (char)node;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
@@ -5361,7 +5365,7 @@ FILESTAMP
|
||||
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
buf[0] = (UINT8)node;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
@@ -5384,9 +5388,9 @@ FILESTAMP
|
||||
*
|
||||
*/
|
||||
static void GetPackets(void)
|
||||
{FILESTAMP
|
||||
XBOXSTATIC SINT8 node; // The packet sender
|
||||
FILESTAMP
|
||||
{
|
||||
SINT8 node; // The packet sender
|
||||
|
||||
|
||||
player_joining = false;
|
||||
|
||||
@@ -6085,7 +6089,7 @@ static inline void PingUpdate(void)
|
||||
UINT8 minimumkicklevel = (nonlaggers > 0) ? PINGKICK_LIMIT : PINGKICK_TICQUEUE;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
XBOXSTATIC char buf[2];
|
||||
char buf[2];
|
||||
|
||||
if (!playeringame[i] || pingkick[i] < minimumkicklevel)
|
||||
continue;
|
||||
@@ -6190,10 +6194,9 @@ void NetKeepAlive(void)
|
||||
|
||||
UpdatePingTable();
|
||||
|
||||
// Sryder: What is FILESTAMP???
|
||||
FILESTAMP
|
||||
// Sryder: What is FILESTAMP??? << lmao
|
||||
|
||||
GetPackets();
|
||||
FILESTAMP
|
||||
|
||||
#ifdef MASTERSERVER
|
||||
MasterClient_Ticker();
|
||||
@@ -6305,9 +6308,9 @@ void NetUpdate(void)
|
||||
|
||||
if (server)
|
||||
CL_SendClientCmd(); // send it
|
||||
FILESTAMP
|
||||
|
||||
GetPackets(); // get packet from client or from server
|
||||
FILESTAMP
|
||||
|
||||
// client send the command after a receive of the server
|
||||
// the server send before because in single player is beter
|
||||
|
||||
|
||||
+55
-115
@@ -15,7 +15,7 @@
|
||||
/// plus functions to parse command line parameters, configure game
|
||||
/// parameters, and call the startup functions.
|
||||
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
@@ -24,22 +24,12 @@
|
||||
#include <unistd.h> // for getcwd
|
||||
#endif
|
||||
|
||||
#ifdef PC_DOS
|
||||
#include <stdio.h> // for snprintf
|
||||
int snprintf(char *str, size_t n, const char *fmt, ...);
|
||||
//int vsnprintf(char *str, size_t n, const char *fmt, va_list ap);
|
||||
#endif
|
||||
|
||||
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#if !defined (UNDER_CE)
|
||||
#include <time.h>
|
||||
#elif defined (_XBOX)
|
||||
#define NO_TIME
|
||||
#endif
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "am_map.h"
|
||||
@@ -86,18 +76,10 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
|
||||
#include "config.h.in"
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX
|
||||
#include "sdl12/SRB2XBOX/xboxhelp.h"
|
||||
#endif
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h" // 3D View Rendering
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include "win32/win_main.h" // I_DoStartupMouse
|
||||
#endif
|
||||
|
||||
#ifdef HW3SOUND
|
||||
#include "hardware/hw3sound.h"
|
||||
#endif
|
||||
@@ -134,19 +116,11 @@ INT32 postimgparam[MAXSPLITSCREENPLAYERS];
|
||||
// These variables are only true if
|
||||
// whether the respective sound system is disabled
|
||||
// or they're init'ed, but the player just toggled them
|
||||
#ifdef _XBOX
|
||||
#ifndef NO_MIDI
|
||||
boolean midi_disabled = true;
|
||||
#endif
|
||||
boolean sound_disabled = true;
|
||||
boolean digital_disabled = true;
|
||||
#else
|
||||
#ifndef NO_MIDI
|
||||
boolean midi_disabled = false;
|
||||
#endif
|
||||
boolean sound_disabled = false;
|
||||
boolean digital_disabled = false;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGFILE
|
||||
INT32 debugload = 0;
|
||||
@@ -154,13 +128,8 @@ INT32 debugload = 0;
|
||||
|
||||
char savegamename[256];
|
||||
|
||||
#ifdef _arch_dreamcast
|
||||
char srb2home[256] = "/cd";
|
||||
char srb2path[256] = "/cd";
|
||||
#else
|
||||
char srb2home[256] = ".";
|
||||
char srb2path[256] = ".";
|
||||
#endif
|
||||
boolean usehome = true;
|
||||
const char *pandf = "%s" PATHSEP "%s";
|
||||
|
||||
@@ -185,10 +154,6 @@ void D_PostEvent(const event_t *ev)
|
||||
events[eventhead] = *ev;
|
||||
eventhead = (eventhead+1) & (MAXEVENTS-1);
|
||||
}
|
||||
// just for lock this function
|
||||
#if defined (PC_DOS) && !defined (DOXYGEN)
|
||||
void D_PostEvent_end(void) {};
|
||||
#endif
|
||||
|
||||
// modifier keys
|
||||
// Now handled in I_OsPolling
|
||||
@@ -663,11 +628,6 @@ void D_SRB2Loop(void)
|
||||
|
||||
// Pushing of + parameters is now done back in D_SRB2Main, not here.
|
||||
|
||||
#ifdef _WINDOWS
|
||||
CONS_Printf("I_StartupMouse()...\n");
|
||||
I_DoStartupMouse();
|
||||
#endif
|
||||
|
||||
I_UpdateTime(cv_timescale.value);
|
||||
oldentertics = I_GetTime();
|
||||
|
||||
@@ -802,9 +762,6 @@ void D_SRB2Loop(void)
|
||||
// consoleplayer -> displayplayers (hear sounds from viewpoint)
|
||||
S_UpdateSounds(); // move positional sounds
|
||||
|
||||
// check for media change, loop music..
|
||||
I_UpdateCD();
|
||||
|
||||
#ifdef HW3SOUND
|
||||
HW3S_EndFrameUpdate();
|
||||
#endif
|
||||
@@ -958,13 +915,20 @@ static boolean AddIWAD(void)
|
||||
}
|
||||
|
||||
boolean found_extra_kart;
|
||||
boolean found_extra2_kart;
|
||||
|
||||
boolean snw_speedo; // snowy speedometer check
|
||||
boolean clr_hud; // colour hud check
|
||||
boolean big_lap; // bigger lap counter
|
||||
boolean big_lap_color; // bigger lap counter but colour
|
||||
|
||||
static void IdentifyVersion(void)
|
||||
{
|
||||
const char *srb2waddir = NULL;
|
||||
found_extra_kart = false;
|
||||
found_extra2_kart = false;
|
||||
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
// change to the directory where 'srb2.srb' is found
|
||||
srb2waddir = I_LocateWad();
|
||||
#endif
|
||||
@@ -976,17 +940,11 @@ static void IdentifyVersion(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if !defined(_WIN32_WCE) && !defined(_PS3)
|
||||
if (getcwd(srb2path, 256) != NULL)
|
||||
srb2waddir = srb2path;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef _arch_dreamcast
|
||||
srb2waddir = "/cd";
|
||||
#else
|
||||
srb2waddir = srb2path;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1020,6 +978,12 @@ static void IdentifyVersion(void)
|
||||
D_AddFile(va(pandf,srb2waddir,"extra.kart"), startupwadfiles);
|
||||
found_extra_kart = true;
|
||||
}
|
||||
|
||||
// completely optional 2: Back with a vengence
|
||||
if (FIL_ReadFileOK(va(pandf,srb2waddir,"extra2.kart"))) {
|
||||
D_AddFile(va(pandf,srb2waddir,"extra2.kart"), startupwadfiles);
|
||||
found_extra2_kart = true;
|
||||
}
|
||||
|
||||
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
|
||||
#define MUSICTEST(str) \
|
||||
@@ -1037,28 +1001,6 @@ static void IdentifyVersion(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ======================================================================== */
|
||||
// Just print the nice red titlebar like the original SRB2 for DOS.
|
||||
/* ======================================================================== */
|
||||
#ifdef PC_DOS
|
||||
static inline void D_Titlebar(char *title1, char *title2)
|
||||
{
|
||||
// SRB2 banner
|
||||
clrscr();
|
||||
textattr((BLUE<<4)+WHITE);
|
||||
clreol();
|
||||
cputs(title1);
|
||||
|
||||
// standard srb2 banner
|
||||
textattr((RED<<4)+WHITE);
|
||||
clreol();
|
||||
gotoxy((80-strlen(title2))/2, 2);
|
||||
cputs(title2);
|
||||
normvideo();
|
||||
gotoxy(1,3);
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// Center the title string, then add the date and time of compilation.
|
||||
//
|
||||
@@ -1086,7 +1028,6 @@ static inline void D_MakeTitleString(char *s)
|
||||
strcpy(s, temp);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// D_SRB2Main
|
||||
//
|
||||
@@ -1117,7 +1058,7 @@ void D_SRB2Main(void)
|
||||
"in this program.\n\n");
|
||||
|
||||
// keep error messages until the final flush(stderr)
|
||||
#if !defined (PC_DOS) && !defined (_WIN32_WCE) && !defined(NOTERMIOS)
|
||||
#if !defined(NOTERMIOS)
|
||||
if (setvbuf(stderr, NULL, _IOFBF, 1000))
|
||||
I_OutputMsg("setvbuf didnt work\n");
|
||||
#endif
|
||||
@@ -1139,29 +1080,23 @@ void D_SRB2Main(void)
|
||||
// identify the main IWAD file to use
|
||||
IdentifyVersion();
|
||||
|
||||
#if !defined (_WIN32_WCE) && !defined(NOTERMIOS)
|
||||
#if !defined(NOTERMIOS)
|
||||
setbuf(stdout, NULL); // non-buffered output
|
||||
#endif
|
||||
|
||||
#if defined (_WIN32_WCE) //|| defined (_DEBUG) || defined (GP2X)
|
||||
#if 0 //defined (_DEBUG)
|
||||
devparm = M_CheckParm("-nodebug") == 0;
|
||||
#else
|
||||
devparm = M_CheckParm("-debug") != 0;
|
||||
#endif
|
||||
|
||||
// for dedicated server
|
||||
#if !defined (_WINDOWS) //already check in win_main.c
|
||||
dedicated = M_CheckParm("-dedicated") != 0;
|
||||
#endif
|
||||
|
||||
strcpy(title, "SRB2Kart");
|
||||
strcpy(srb2, "SRB2Kart");
|
||||
D_MakeTitleString(srb2);
|
||||
|
||||
#ifdef PC_DOS
|
||||
D_Titlebar(srb2, title);
|
||||
#endif
|
||||
|
||||
#if defined (__OS2__) && !defined (HAVE_SDL)
|
||||
// set PM window title
|
||||
snprintf(pmData->title, sizeof (pmData->title),
|
||||
@@ -1183,13 +1118,8 @@ void D_SRB2Main(void)
|
||||
|
||||
if (!userhome)
|
||||
{
|
||||
#if ((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__) && !defined (DC) && !defined (PSP) && !defined(GP2X)
|
||||
#if (defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__)
|
||||
I_Error("Please set $HOME to your home directory\n");
|
||||
#elif defined (_WIN32_WCE) && 0
|
||||
if (dedicated)
|
||||
snprintf(configfile, sizeof configfile, "/Storage Card/SRB2DEMO/d"CONFIGFILENAME);
|
||||
else
|
||||
snprintf(configfile, sizeof configfile, "/Storage Card/SRB2DEMO/"CONFIGFILENAME);
|
||||
#else
|
||||
if (dedicated)
|
||||
snprintf(configfile, sizeof configfile, "d"CONFIGFILENAME);
|
||||
@@ -1246,10 +1176,6 @@ void D_SRB2Main(void)
|
||||
fclose(tmpfile);
|
||||
remove(testfile);
|
||||
}
|
||||
|
||||
#ifdef _arch_dreamcast
|
||||
strcpy(downloaddir, "/ram"); // the dreamcast's TMP
|
||||
#endif
|
||||
}
|
||||
|
||||
D_SetupProtocol();
|
||||
@@ -1345,8 +1271,31 @@ void D_SRB2Main(void)
|
||||
|
||||
#endif //ifndef DEVELOP
|
||||
|
||||
if (found_extra_kart) // found the funny, add it in!
|
||||
mainwads++;
|
||||
if (found_extra_kart || found_extra2_kart) // found the funny, add it in!
|
||||
{
|
||||
// HAYA: These are seperated for a reason lmao
|
||||
if (found_extra_kart)
|
||||
mainwads++;
|
||||
if (found_extra2_kart)
|
||||
mainwads++;
|
||||
|
||||
// now check for speedometer stuff
|
||||
if (W_CheckMultipleLumps("SP_SMSTC", "K_TRNULL", "SP_MKMH", "SP_MMPH", "SP_MFRAC", "SP_MPERC", NULL))
|
||||
snw_speedo = true;
|
||||
|
||||
// check for bigger lap count
|
||||
if (W_CheckMultipleLumps("K_STLAPB", "K_STLA2B", NULL))
|
||||
big_lap = true;
|
||||
|
||||
// now check for colour hud stuff
|
||||
if (W_CheckMultipleLumps("K_SCTIME", "K_SCTIMW", "K_SCLAPS", "K_SCLAPW", \
|
||||
"K_SCBALN", "K_SCBALW", "K_SCKARM", "K_SCTOUT", "K_ISMULC", "K_ITMULC", "K_ITBC","K_ITBCD", "K_ISBC", "K_ISBCD", NULL))
|
||||
clr_hud = true;
|
||||
|
||||
// check for bigger lap count but color** its color bitch
|
||||
if (W_CheckMultipleLumps("K_SCLAPB", "K_SCLA2B", NULL))
|
||||
big_lap_color = true;
|
||||
}
|
||||
|
||||
//
|
||||
// search for maps
|
||||
@@ -1416,6 +1365,13 @@ void D_SRB2Main(void)
|
||||
CONS_Printf("I_StartupGraphics()...\n");
|
||||
I_StartupGraphics();
|
||||
|
||||
#ifdef HWRENDER
|
||||
// Lactozilla: Add every hardware mode CVAR and CCMD.
|
||||
// Has to be done before the configuration file loads,
|
||||
// but after the OpenGL library loads.
|
||||
HWR_AddCommands();
|
||||
#endif
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
@@ -1433,12 +1389,7 @@ void D_SRB2Main(void)
|
||||
HU_Init();
|
||||
|
||||
COM_Init();
|
||||
// libogc has a CON_Init function, we must rename SRB2's CON_Init in WII/libogc
|
||||
#ifndef _WII
|
||||
CON_Init();
|
||||
#else
|
||||
CON_InitWii();
|
||||
#endif
|
||||
|
||||
D_RegisterServerCommands();
|
||||
D_RegisterClientCommands(); // be sure that this is called before D_CheckNetGame
|
||||
@@ -1452,7 +1403,7 @@ void D_SRB2Main(void)
|
||||
|
||||
G_LoadGameData();
|
||||
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen
|
||||
#endif
|
||||
|
||||
@@ -1482,10 +1433,6 @@ void D_SRB2Main(void)
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize CD-Audio
|
||||
if (M_CheckParm("-usecd") && !dedicated)
|
||||
I_InitCD();
|
||||
|
||||
if (M_CheckParm("-noupload"))
|
||||
COM_BufAddText("downloading 0\n");
|
||||
|
||||
@@ -1772,26 +1719,19 @@ const char *D_Home(void)
|
||||
#ifdef ANDROID
|
||||
return "/data/data/org.srb2/";
|
||||
#endif
|
||||
#ifdef _arch_dreamcast
|
||||
char VMUHOME[] = "HOME=/vmu/a1";
|
||||
putenv(VMUHOME); //don't use I_PutEnv
|
||||
#endif
|
||||
|
||||
if (M_CheckParm("-home") && M_IsNextParm())
|
||||
userhome = M_GetNextParm();
|
||||
else
|
||||
{
|
||||
#if defined (GP2X)
|
||||
usehome = false; //let use the CWD
|
||||
return NULL;
|
||||
#elif !((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__APPLE__) && !defined(_WIN32_WCE)
|
||||
#if !(defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON))
|
||||
if (FIL_FileOK(CONFIGFILENAME))
|
||||
usehome = false; // Let's NOT use home
|
||||
else
|
||||
#endif
|
||||
userhome = I_GetEnv("HOME"); //Alam: my new HOME for srb2
|
||||
}
|
||||
#if defined (_WIN32) && !defined(_WIN32_WCE) //Alam: only Win32 have APPDATA and USERPROFILE
|
||||
#ifdef _WIN32 //Alam: only Win32 have APPDATA and USERPROFILE
|
||||
if (!userhome && usehome) //Alam: Still not?
|
||||
{
|
||||
char *testhome = NULL;
|
||||
|
||||
+6
-3
@@ -26,6 +26,12 @@ extern const char *pandf; //Alam: how to path?
|
||||
extern char srb2path[256]; //Alam: SRB2's Home
|
||||
|
||||
extern boolean found_extra_kart; // for use in k_kart.c
|
||||
extern boolean found_extra2_kart; // for use in k_kart.c
|
||||
|
||||
extern boolean snw_speedo; // snowy speedometer check
|
||||
extern boolean clr_hud; // colour hud check
|
||||
extern boolean big_lap; // bigger lap counter
|
||||
extern boolean big_lap_color; //bigger lap counter but colour
|
||||
|
||||
// the infinite loop of D_SRB2Loop() called from win_main for windows version
|
||||
void D_SRB2Loop(void) FUNCNORETURN;
|
||||
@@ -39,9 +45,6 @@ void D_SRB2Main(void);
|
||||
|
||||
// Called by IO functions when input is detected.
|
||||
void D_PostEvent(const event_t *ev);
|
||||
#if defined (PC_DOS) && !defined (DOXYGEN)
|
||||
void D_PostEvent_end(void); // delimiter for locking memory
|
||||
#endif
|
||||
|
||||
void D_ProcessEvents(void);
|
||||
|
||||
|
||||
@@ -1352,11 +1352,6 @@ boolean D_CheckNetGame(void)
|
||||
holepunchpacket = (holepunch_t *)(void *)&doomcom->data;
|
||||
|
||||
#ifdef DEBUGFILE
|
||||
#ifdef _arch_dreamcast
|
||||
//debugfile = stderr;
|
||||
if (debugfile)
|
||||
CONS_Printf(M_GetText("debug output to: %s\n"), "STDERR");
|
||||
#else
|
||||
if (M_CheckParm("-debugfile"))
|
||||
{
|
||||
char filename[21];
|
||||
@@ -1374,7 +1369,6 @@ boolean D_CheckNetGame(void)
|
||||
else
|
||||
CONS_Alert(CONS_WARNING, M_GetText("cannot debug output to file %s!\n"), va("%s" PATHSEP "%s", srb2home, filename));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
D_ClientServerInit();
|
||||
|
||||
+226
-94
@@ -49,6 +49,7 @@
|
||||
#include "m_anigif.h"
|
||||
#include "k_kart.h" // SRB2kart
|
||||
#include "y_inter.h"
|
||||
#include "fastcmp.h"
|
||||
#include "m_perfstats.h"
|
||||
|
||||
#ifdef NETGAME_DEVMODE
|
||||
@@ -141,6 +142,8 @@ static void Command_SetViews_f(void);
|
||||
|
||||
static void Command_Addfilelocal(void);
|
||||
static void Command_Addfile(void);
|
||||
static void Command_Addskins(void);
|
||||
static void Command_GLocalSkin(void);
|
||||
static void Command_ListWADS_f(void);
|
||||
#ifdef DELFILE
|
||||
static void Command_Delfile(void);
|
||||
@@ -210,7 +213,7 @@ void SendWeaponPref3(void);
|
||||
void SendWeaponPref4(void);
|
||||
|
||||
static CV_PossibleValue_t usemouse_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Force"}, {0, NULL}};
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
||||
static CV_PossibleValue_t mouse2port_cons_t[] = {{0, "/dev/gpmdata"}, {1, "/dev/ttyS0"},
|
||||
{2, "/dev/ttyS1"}, {3, "/dev/ttyS2"}, {4, "/dev/ttyS3"}, {0, NULL}};
|
||||
#else
|
||||
@@ -289,6 +292,8 @@ consvar_t cv_skin = {"skin", DEFAULTSKIN, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin_
|
||||
consvar_t cv_skin2 = {"skin2", DEFAULTSKIN2, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_skin3 = {"skin3", DEFAULTSKIN3, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin3_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_skin4 = {"skin4", DEFAULTSKIN4, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin4_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
// haha I've beaten you now, ONLINE
|
||||
consvar_t cv_localskin = {"internal___localskin", "none", CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -297,7 +302,7 @@ INT32 cv_debug;
|
||||
consvar_t cv_usemouse = {"use_mouse", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_usemouse2 = {"use_mouse2", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse2, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#if defined (DC) || defined (_XBOX) || defined (WMINPUT) || defined (_WII) || defined(HAVE_SDL) || defined(_WINDOWS) //joystick 1 and 2
|
||||
#if defined(HAVE_SDL) || defined(_WINDOWS) //joystick 1 and 2
|
||||
consvar_t cv_usejoystick = {"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||
I_InitJoystick, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_usejoystick2 = {"use_joystick2", "2", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||
@@ -321,7 +326,7 @@ consvar_t cv_joyscale4 = {"joyscale4", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale4,
|
||||
consvar_t cv_joyscale = {"joyscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: Dummy for save
|
||||
consvar_t cv_joyscale2 = {"joyscale2", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: Dummy for save
|
||||
#endif
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
||||
consvar_t cv_mouse2port = {"mouse2port", "/dev/gpmdata", CV_SAVE, mouse2port_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_mouse2opt = {"mouse2opt", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#else
|
||||
@@ -370,6 +375,9 @@ consvar_t cv_tripleorbinaut = {"tripleorbinaut", "On", CV_NETVAR|CV_CHEAT, C
|
||||
consvar_t cv_quadorbinaut = {"quadorbinaut", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_dualjawz = {"dualjawz", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
//Save server ip
|
||||
consvar_t cv_lastserver = {"lastserver", "", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t kartminimap_cons_t[] = {{0, "MIN"}, {10, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_kartminimap = {"kartminimap", "4", CV_SAVE, kartminimap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartcheck = {"kartcheck", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -447,6 +455,7 @@ static CV_PossibleValue_t basenumlaps_cons_t[] = {{1, "MIN"}, {50, "MAX"}, {0, "
|
||||
consvar_t cv_basenumlaps = {"basenumlaps", "Map default", CV_NETVAR|CV_CALL|CV_CHEAT, basenumlaps_cons_t, BaseNumLaps_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_forceskin = {"forceskin", "Off", CV_NETVAR|CV_CALL|CV_CHEAT, Forceskin_cons_t, ForceSkin_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fakelocalskin = {"fakelocalskin", "None", CV_SAVE, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_downloading = {"downloading", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_allowexitlevel = {"allowexitlevel", "No", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -468,6 +477,7 @@ consvar_t cv_showping = {"showping", "Always", CV_SAVE, showping_cons_t, NULL, 0
|
||||
|
||||
static CV_PossibleValue_t pingmeasurement_cons_t[] = {{0, "Frames"}, {1, "Milliseconds"}, {0, NULL}};
|
||||
consvar_t cv_pingmeasurement = {"pingmeasurement", "Frames", CV_SAVE, pingmeasurement_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_luaimmersion = {"luaimmersion", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_minihead = {"smallminimapplayers", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -512,7 +522,7 @@ consvar_t cv_ps_descriptor = {"ps_descriptor", "Average", 0, ps_descriptor_cons_
|
||||
|
||||
consvar_t cv_showtrackaddon = {"showtrackaddon", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t skinselectmenu_t[] = {{SKINMENUTYPE_SCROLL, "Scoll"}, {SKINMENUTYPE_2D, "2d"}, {SKINMENUTYPE_GRID, "Grid"}, {0, NULL}};
|
||||
static CV_PossibleValue_t skinselectmenu_t[] = {{SKINMENUTYPE_SCROLL, "Scroll"}, {SKINMENUTYPE_2D, "2d"}, {SKINMENUTYPE_GRID, "Grid"}, {0, NULL}};
|
||||
consvar_t cv_skinselectmenu = {"skinselectmenu", "Grid", CV_SAVE, skinselectmenu_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t skinselectgridsort_t[] ={
|
||||
@@ -643,6 +653,8 @@ void D_RegisterServerCommands(void)
|
||||
|
||||
COM_AddCommand("addfilelocal", Command_Addfilelocal);
|
||||
COM_AddCommand("addfile", Command_Addfile);
|
||||
COM_AddCommand("addskins", Command_Addskins);
|
||||
COM_AddCommand("localskin", Command_GLocalSkin);
|
||||
COM_AddCommand("listwad", Command_ListWADS_f);
|
||||
|
||||
#ifdef DELFILE
|
||||
@@ -709,8 +721,6 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_powerstones);
|
||||
CV_RegisterVar(&cv_competitionboxes);
|
||||
CV_RegisterVar(&cv_matchboxes);
|
||||
|
||||
CV_RegisterVar(&cv_slamsound);
|
||||
|
||||
/*CV_RegisterVar(&cv_recycler);
|
||||
CV_RegisterVar(&cv_teleporters);
|
||||
@@ -776,15 +786,6 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_pingtimeout);
|
||||
CV_RegisterVar(&cv_showping);
|
||||
CV_RegisterVar(&cv_pingmeasurement);
|
||||
|
||||
CV_RegisterVar(&cv_minihead);
|
||||
CV_RegisterVar(&cv_showminimapnames);
|
||||
|
||||
CV_RegisterVar(&cv_showlapemblem);
|
||||
|
||||
CV_RegisterVar(&cv_showtrackaddon);
|
||||
|
||||
CV_RegisterVar(&cv_showviewpointtext);
|
||||
|
||||
#ifdef SEENAMES
|
||||
CV_RegisterVar(&cv_allowseenames);
|
||||
@@ -802,6 +803,8 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_recordmultiplayerdemos);
|
||||
CV_RegisterVar(&cv_netdemosyncquality);
|
||||
CV_RegisterVar(&cv_maxdemosize);
|
||||
|
||||
CV_RegisterVar(&cv_cechotoggle);
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
@@ -885,6 +888,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_playername);
|
||||
CV_RegisterVar(&cv_playercolor);
|
||||
CV_RegisterVar(&cv_skin); // r_things.c (skin NAME)
|
||||
CV_RegisterVar(&cv_localskin);
|
||||
// secondary player (splitscreen)
|
||||
CV_RegisterVar(&cv_playername2);
|
||||
CV_RegisterVar(&cv_playercolor2);
|
||||
@@ -927,6 +931,8 @@ void D_RegisterClientCommands(void)
|
||||
|
||||
COM_AddCommand("displayplayer", Command_Displayplayer_f);
|
||||
|
||||
CV_RegisterVar(&cv_audbuffersize);
|
||||
|
||||
#ifdef HAVE_OPENMPT
|
||||
CV_RegisterVar(&cv_modfilter);
|
||||
CV_RegisterVar(&cv_stereosep);
|
||||
@@ -949,33 +955,16 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_chatnotifications);
|
||||
CV_RegisterVar(&cv_chatbacktint);
|
||||
CV_RegisterVar(&cv_songcredits);
|
||||
CV_RegisterVar(&cv_showfreeplay);
|
||||
|
||||
CV_RegisterVar(&cv_item_xoffset);
|
||||
CV_RegisterVar(&cv_item_yoffset);
|
||||
CV_RegisterVar(&cv_time_xoffset);
|
||||
CV_RegisterVar(&cv_time_yoffset);
|
||||
CV_RegisterVar(&cv_laps_xoffset);
|
||||
CV_RegisterVar(&cv_laps_yoffset);
|
||||
CV_RegisterVar(&cv_spdm_xoffset);
|
||||
CV_RegisterVar(&cv_spdm_yoffset);
|
||||
CV_RegisterVar(&cv_posi_xoffset);
|
||||
CV_RegisterVar(&cv_posi_yoffset);
|
||||
CV_RegisterVar(&cv_face_xoffset);
|
||||
CV_RegisterVar(&cv_face_yoffset);
|
||||
CV_RegisterVar(&cv_stcd_xoffset);
|
||||
CV_RegisterVar(&cv_stcd_yoffset);
|
||||
CV_RegisterVar(&cv_chek_yoffset);
|
||||
CV_RegisterVar(&cv_mini_xoffset);
|
||||
CV_RegisterVar(&cv_mini_yoffset);
|
||||
CV_RegisterVar(&cv_want_xoffset);
|
||||
CV_RegisterVar(&cv_want_yoffset);
|
||||
CV_RegisterVar(&cv_showinput);
|
||||
CV_RegisterVar(&cv_newspeedometer);
|
||||
|
||||
CV_RegisterVar(&cv_saltyhop);
|
||||
CV_RegisterVar(&cv_saltyhopsfx);
|
||||
CV_RegisterVar(&cv_saltysquish);
|
||||
CV_RegisterVar(&cv_showfreeplay);
|
||||
|
||||
CV_RegisterVar(&cv_growmusic);
|
||||
CV_RegisterVar(&cv_supermusic);
|
||||
|
||||
CV_RegisterVar(&cv_showtrackaddon);
|
||||
CV_RegisterVar(&cv_showviewpointtext);
|
||||
|
||||
CV_RegisterVar(&cv_luaimmersion);
|
||||
CV_RegisterVar(&cv_fakelocalskin);
|
||||
|
||||
//CV_RegisterVar(&cv_crosshair);
|
||||
//CV_RegisterVar(&cv_crosshair2);
|
||||
@@ -1041,7 +1030,7 @@ void D_RegisterClientCommands(void)
|
||||
// WARNING: the order is important when initialising mouse2
|
||||
// we need the mouse2port
|
||||
CV_RegisterVar(&cv_mouse2port);
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
||||
CV_RegisterVar(&cv_mouse2opt);
|
||||
#endif
|
||||
CV_RegisterVar(&cv_controlperkey);
|
||||
@@ -1089,10 +1078,6 @@ void D_RegisterClientCommands(void)
|
||||
#endif
|
||||
CV_RegisterVar(&cv_numChannels);
|
||||
|
||||
// i_cdmus.c
|
||||
CV_RegisterVar(&cd_volume);
|
||||
CV_RegisterVar(&cdUpdate);
|
||||
|
||||
// screen.c
|
||||
CV_RegisterVar(&cv_fullscreen);
|
||||
CV_RegisterVar(&cv_renderview);
|
||||
@@ -1121,6 +1106,11 @@ void D_RegisterClientCommands(void)
|
||||
|
||||
CV_RegisterVar(&cv_resume);
|
||||
CV_RegisterVar(&cv_fading);
|
||||
|
||||
//Value used to store last server player has joined
|
||||
CV_RegisterVar(&cv_lastserver);
|
||||
|
||||
CV_RegisterVar(&cv_showallmaps);
|
||||
|
||||
// ingame object placing
|
||||
COM_AddCommand("objectplace", Command_ObjectPlace_f);
|
||||
@@ -1424,7 +1414,7 @@ static void SetPlayerName(INT32 playernum, char *newname)
|
||||
CONS_Printf(M_GetText("Player %d sent a bad name change\n"), playernum+1);
|
||||
if (server && netgame)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -1508,7 +1498,7 @@ static INT32 snacpending = 0, snac2pending = 0, snac3pending = 0, snac4pending =
|
||||
//
|
||||
static void SendNameAndColor(void)
|
||||
{
|
||||
XBOXSTATIC char buf[MAXPLAYERNAME+2];
|
||||
char buf[MAXPLAYERNAME+2];
|
||||
char *p;
|
||||
|
||||
p = buf;
|
||||
@@ -1630,7 +1620,7 @@ static void SendNameAndColor(void)
|
||||
static void SendNameAndColor2(void)
|
||||
{
|
||||
INT32 secondplaya = -1;
|
||||
XBOXSTATIC char buf[MAXPLAYERNAME+2];
|
||||
char buf[MAXPLAYERNAME+2];
|
||||
char *p;
|
||||
|
||||
if (splitscreen < 1 && !botingame)
|
||||
@@ -1758,7 +1748,7 @@ static void SendNameAndColor2(void)
|
||||
static void SendNameAndColor3(void)
|
||||
{
|
||||
INT32 thirdplaya = -1;
|
||||
XBOXSTATIC char buf[MAXPLAYERNAME+2];
|
||||
char buf[MAXPLAYERNAME+2];
|
||||
char *p;
|
||||
|
||||
if (splitscreen < 2)
|
||||
@@ -1878,7 +1868,7 @@ static void SendNameAndColor3(void)
|
||||
static void SendNameAndColor4(void)
|
||||
{
|
||||
INT32 fourthplaya = -1;
|
||||
XBOXSTATIC char buf[MAXPLAYERNAME+2];
|
||||
char buf[MAXPLAYERNAME+2];
|
||||
char *p;
|
||||
|
||||
if (splitscreen < 3)
|
||||
@@ -2066,7 +2056,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
||||
|
||||
if (kick)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal color change received from %s (team: %d), color: %d)\n"), player_names[playernum], p->ctfteam, p->skincolor);
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
@@ -2102,7 +2092,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
||||
|
||||
void SendWeaponPref(void)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[1];
|
||||
UINT8 buf[1];
|
||||
|
||||
buf[0] = 0;
|
||||
if (cv_flipcam.value)
|
||||
@@ -2114,7 +2104,7 @@ void SendWeaponPref(void)
|
||||
|
||||
void SendWeaponPref2(void)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[1];
|
||||
UINT8 buf[1];
|
||||
|
||||
buf[0] = 0;
|
||||
if (cv_flipcam2.value)
|
||||
@@ -2126,7 +2116,7 @@ void SendWeaponPref2(void)
|
||||
|
||||
void SendWeaponPref3(void)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[1];
|
||||
UINT8 buf[1];
|
||||
|
||||
buf[0] = 0;
|
||||
if (cv_flipcam3.value)
|
||||
@@ -2138,7 +2128,7 @@ void SendWeaponPref3(void)
|
||||
|
||||
void SendWeaponPref4(void)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[1];
|
||||
UINT8 buf[1];
|
||||
|
||||
buf[0] = 0;
|
||||
if (cv_flipcam4.value)
|
||||
@@ -2933,7 +2923,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal map change received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -3016,7 +3006,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
||||
|
||||
static void Command_Pause(void)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
UINT8 *cp = buf;
|
||||
|
||||
if (COM_Argc() > 1)
|
||||
@@ -3058,7 +3048,7 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal pause command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -3121,7 +3111,7 @@ static void Command_ReplayMarker(void)
|
||||
// Command for stuck characters in netgames, griefing, etc.
|
||||
static void Command_Respawn(void)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[4];
|
||||
UINT8 buf[4];
|
||||
UINT8 *cp = buf;
|
||||
|
||||
WRITEINT32(cp, consoleplayer);
|
||||
@@ -3171,7 +3161,7 @@ static void Got_Respawn(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal respawn command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -3245,7 +3235,7 @@ static void Got_Clearscores(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal clear scores command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -3768,7 +3758,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -3783,7 +3773,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -3821,7 +3811,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -3874,7 +3864,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
|
||||
if (server && ((NetPacket.packet.newteam < 0 || NetPacket.packet.newteam > 3) || error))
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -4055,7 +4045,7 @@ static void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt,
|
||||
(void)salt;
|
||||
memset(dest, 0, 16);
|
||||
#else
|
||||
XBOXSTATIC char tmpbuf[256];
|
||||
char tmpbuf[256];
|
||||
const size_t sl = strlen(salt);
|
||||
|
||||
if (len > 256-sl)
|
||||
@@ -4113,7 +4103,7 @@ static void Command_Login_f(void)
|
||||
// If we have no MD5 support then completely disable XD_LOGIN responses for security.
|
||||
CONS_Alert(CONS_NOTICE, "Remote administration commands are not supported in this build.\n");
|
||||
#else
|
||||
XBOXSTATIC UINT8 finalmd5[MD5_LEN];
|
||||
UINT8 finalmd5[MD5_LEN];
|
||||
const char *pw;
|
||||
|
||||
if (!netgame)
|
||||
@@ -4220,7 +4210,7 @@ void RemoveAdminPlayer(INT32 playernum)
|
||||
|
||||
static void Command_Verify_f(void)
|
||||
{
|
||||
XBOXSTATIC char buf[8]; // Should be plenty
|
||||
char buf[8]; // Should be plenty
|
||||
char *temp;
|
||||
INT32 playernum;
|
||||
|
||||
@@ -4263,7 +4253,7 @@ static void Got_Verification(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal verification received from %s (serverplayer is %s)\n"), player_names[playernum], player_names[serverplayer]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -4282,7 +4272,7 @@ static void Got_Verification(UINT8 **cp, INT32 playernum)
|
||||
|
||||
static void Command_RemoveAdmin_f(void)
|
||||
{
|
||||
XBOXSTATIC char buf[8]; // Should be plenty
|
||||
char buf[8]; // Should be plenty
|
||||
char *temp;
|
||||
INT32 playernum;
|
||||
|
||||
@@ -4319,7 +4309,7 @@ static void Got_Removal(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal demotion received from %s (serverplayer is %s)\n"), player_names[playernum], player_names[serverplayer]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -4399,7 +4389,7 @@ static void Got_MotD_f(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal motd change received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -4420,7 +4410,7 @@ static void Got_MotD_f(UINT8 **cp, INT32 playernum)
|
||||
static void Command_RunSOC(void)
|
||||
{
|
||||
const char *fn;
|
||||
XBOXSTATIC char buf[255];
|
||||
char buf[255];
|
||||
size_t length = 0;
|
||||
|
||||
if (COM_Argc() != 2)
|
||||
@@ -4462,7 +4452,7 @@ static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal runsoc command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -4530,7 +4520,7 @@ static void Command_Addfilelocal(void)
|
||||
static void Command_Addfile(void)
|
||||
{
|
||||
const char *fn, *p;
|
||||
XBOXSTATIC char buf[256];
|
||||
char buf[256];
|
||||
char *buf_p = buf;
|
||||
INT32 i;
|
||||
int musiconly; // W_VerifyNMUSlumps isn't boolean
|
||||
@@ -4564,7 +4554,7 @@ static void Command_Addfile(void)
|
||||
// Add file on your client directly if it is trivial, or you aren't in a netgame.
|
||||
if (!(netgame || multiplayer) || musiconly)
|
||||
{
|
||||
P_AddWadFile(fn);
|
||||
P_AddWadFile(fn, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4613,6 +4603,156 @@ static void Command_Addfile(void)
|
||||
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);
|
||||
}
|
||||
|
||||
// i hate myself
|
||||
static boolean DumbStartsWith(const char *pre, const char *str)
|
||||
{
|
||||
size_t lenpre = strlen(pre),
|
||||
lenstr = strlen(str);
|
||||
return lenstr < lenpre ? false : memcmp(pre, str, lenpre) == 0;
|
||||
}
|
||||
|
||||
/** Adds something at runtime.
|
||||
*/
|
||||
static void
|
||||
Command_Addskins (void)
|
||||
{
|
||||
if (COM_Argc() > 3)
|
||||
{
|
||||
CONS_Printf(
|
||||
"addskins <file>: Load a skin file.\n");
|
||||
return;
|
||||
}
|
||||
// no forcing?
|
||||
/*
|
||||
if (fasticmp(COM_Argv(2), "-force") || fasticmp(COM_Argv(2), "-f")) {
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Adding file %s. May or may not be a skin.\n"), COM_Argv(1));
|
||||
P_AddWadFile(COM_Argv(1), 0, true);
|
||||
} else {
|
||||
if (DumbStartsWith("KC_", COM_Argv(1))) {
|
||||
P_AddWadFile(COM_Argv(1), 0, true);
|
||||
} else if (DumbStartsWith("KCL_", COM_Argv(1))) {
|
||||
if (!demo.playback) {
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Cannot add file %s as it is a skin with lua. Include -force or -f to force it to load.\n"), COM_Argv(1));
|
||||
return;
|
||||
} else {
|
||||
*/
|
||||
P_AddWadFile(COM_Argv(1), true);
|
||||
/*
|
||||
}
|
||||
} else {
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Cannot add file %s as it is not a skin.\n"), COM_Argv(1));
|
||||
return;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// args n stuff
|
||||
#include "args.h"
|
||||
|
||||
static void Command_GLocalSkin (void)
|
||||
{
|
||||
size_t first_option;
|
||||
size_t option_display;
|
||||
size_t option_all;
|
||||
size_t option_player;
|
||||
|
||||
option_player = COM_CheckPartialParm("-p");
|
||||
option_display = COM_CheckPartialParm("-d");
|
||||
option_all = COM_CheckPartialParm("-a");
|
||||
|
||||
char* fuck; // local skin name
|
||||
|
||||
if (!( first_option = COM_FirstOption() ))
|
||||
first_option = COM_Argc();
|
||||
|
||||
if (first_option < 2)
|
||||
{
|
||||
/* holy fucking shit */
|
||||
CONS_Printf("localskin <name> [-player <name>] [-display <number>] [-all]:\n");
|
||||
CONS_Printf(M_GetText("Set a localskin via its internal name (usually printed on the console).\n\n\
|
||||
* Using \"-player\" will set a localskin to a specified player.\n\
|
||||
Defaults to yourself.\n\
|
||||
* Using \"-display\" will set a localskin to the displayed player.\n\
|
||||
Defaults to 0, which is the first player displayed.\n\
|
||||
Can go up to 3 for splitscreen.\n\
|
||||
* Using \"-all\" will set a localskin to ALL players.\n\
|
||||
* \"localskin none\" removes the localskin, just like how\n\
|
||||
\"forceskin none\" does.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
fuck = ConcatCommandArgv(1, first_option);
|
||||
|
||||
char* player_name = player_names[consoleplayer];
|
||||
char* display_num = "0";
|
||||
size_t dnum = 0;
|
||||
|
||||
if (option_display) // -display
|
||||
{
|
||||
// handle default: 0
|
||||
if (COM_Argv(option_display + 1)[0] == "" || COM_Argv(option_display + 1)[0] != "-")
|
||||
display_num = COM_Argv(option_display + 1);
|
||||
|
||||
if (isdigit(display_num[0]) || display_num == "0")
|
||||
{
|
||||
dnum = atoi(display_num);
|
||||
if (dnum > 3 || dnum < 0) // nuh uh
|
||||
dnum = 0;
|
||||
SetLocalPlayerSkin(displayplayers[dnum], fuck, NULL);
|
||||
|
||||
CONS_Printf("Successfully applied localskin to displayed player.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CONS_Printf("Could not apply localskin.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
else if (option_all) // -all
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; ++i)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
SetLocalPlayerSkin(i, fuck, NULL);
|
||||
}
|
||||
CONS_Printf("Successfully applied localskin to all players.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
else // -player or no other arguments
|
||||
{
|
||||
if (option_player)
|
||||
{
|
||||
int i;
|
||||
player_name = COM_Argv(option_player + 1);
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; ++i)
|
||||
{
|
||||
if (fasticmp(player_names[i], player_name))
|
||||
SetLocalPlayerSkin(i, fuck, NULL);
|
||||
}
|
||||
CONS_Printf("Successfully applied localskin to specified player.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalPlayerSkin(consoleplayer, fuck, &cv_localskin);
|
||||
CONS_Printf("Successfully applied localskin.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
CONS_Printf("Could not apply localskin.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DELFILE
|
||||
/** removes the last added pwad at runtime.
|
||||
* Searches for sounds, maps, music and images to remove
|
||||
@@ -4676,7 +4816,7 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
|
||||
|
||||
if ((playernum != serverplayer && !IsPlayerAdmin(playernum)) || kick)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal addfile command received from %s\n"), player_names[playernum]);
|
||||
|
||||
@@ -4725,7 +4865,7 @@ static void Got_Delfilecmd(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal delfile command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -4758,7 +4898,7 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal addfile command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -4769,7 +4909,7 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
|
||||
|
||||
ncs = findfile(filename,md5sum,true);
|
||||
|
||||
if (ncs != FS_FOUND || !P_AddWadFile(filename))
|
||||
if (ncs != FS_FOUND || !P_AddWadFile(filename, false))
|
||||
{
|
||||
Command_ExitGame_f();
|
||||
if (ncs == FS_FOUND)
|
||||
@@ -4832,8 +4972,6 @@ static void Command_Version_f(void)
|
||||
// Base library
|
||||
#if defined( HAVE_SDL)
|
||||
CONS_Printf("SDL ");
|
||||
#elif defined(_WINDOWS)
|
||||
CONS_Printf("DD ");
|
||||
#endif
|
||||
|
||||
// OS
|
||||
@@ -4858,11 +4996,6 @@ static void Command_Version_f(void)
|
||||
else // 16-bit? 128-bit?
|
||||
CONS_Printf("Bits Unknown ");
|
||||
|
||||
// No ASM?
|
||||
#ifdef NOASM
|
||||
CONS_Printf("\x85" "NOASM " "\x80");
|
||||
#endif
|
||||
|
||||
// Debug build
|
||||
#ifdef _DEBUG
|
||||
CONS_Printf("\x85" "DEBUG " "\x80");
|
||||
@@ -5450,7 +5583,7 @@ static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal exitlevel command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -5472,7 +5605,7 @@ static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal vote setup received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -5537,7 +5670,7 @@ static void Got_PickVotecmd(UINT8 **cp, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal vote setup received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
@@ -5925,7 +6058,6 @@ static void Command_ListSkins(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Sends a color change for the console player, unless that player is moving.
|
||||
* \sa cv_playercolor, Color2_OnChange, Skin_OnChange
|
||||
* \author Graue <graue@oceanbase.org>
|
||||
@@ -6162,7 +6294,7 @@ void Got_DiscordInfo(UINT8 **p, INT32 playernum)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal Discord info command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
|
||||
+7
-1
@@ -21,6 +21,7 @@
|
||||
extern consvar_t cv_playername;
|
||||
extern consvar_t cv_playercolor;
|
||||
extern consvar_t cv_skin;
|
||||
extern consvar_t cv_localskin;
|
||||
// secondary splitscreen player
|
||||
extern consvar_t cv_playername2;
|
||||
extern consvar_t cv_playercolor2;
|
||||
@@ -56,7 +57,7 @@ extern consvar_t cv_joyscale4;
|
||||
// splitscreen with second mouse
|
||||
extern consvar_t cv_mouse2port;
|
||||
extern consvar_t cv_usemouse2;
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON)
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
||||
extern consvar_t cv_mouse2opt;
|
||||
#endif
|
||||
|
||||
@@ -110,6 +111,9 @@ extern consvar_t cv_thundershield, cv_hyudoro, cv_pogospring, cv_kitchensink;
|
||||
extern consvar_t cv_triplesneaker, cv_triplebanana, cv_decabanana;
|
||||
extern consvar_t cv_tripleorbinaut, cv_quadorbinaut, cv_dualjawz;
|
||||
|
||||
//Lastserver
|
||||
extern consvar_t cv_lastserver;
|
||||
|
||||
extern consvar_t cv_kartminimap;
|
||||
extern consvar_t cv_kartcheck;
|
||||
extern consvar_t cv_kartinvinsfx;
|
||||
@@ -157,6 +161,8 @@ extern consvar_t cv_minihead;
|
||||
extern consvar_t cv_showlapemblem;
|
||||
|
||||
extern consvar_t cv_showviewpointtext;
|
||||
extern consvar_t cv_luaimmersion;
|
||||
extern consvar_t cv_fakelocalskin;
|
||||
|
||||
extern consvar_t cv_skipmapcheck;
|
||||
|
||||
|
||||
+32
-21
@@ -11,21 +11,17 @@
|
||||
/// \brief Transfer a file using HSendPacket.
|
||||
|
||||
#include <stdio.h>
|
||||
#ifndef _WIN32_WCE
|
||||
#ifdef __OS2__
|
||||
#include <sys/types.h>
|
||||
#endif // __OS2__
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#if !defined (UNDER_CE)
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#if ((defined (_WIN32) && !defined (_WIN32_WCE)) || defined (__DJGPP__)) && !defined (_XBOX)
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
#elif !defined (_WIN32_WCE) && !(defined (_XBOX) && !defined (__GNUC__))
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <utime.h>
|
||||
@@ -34,13 +30,9 @@
|
||||
#ifdef __GNUC__
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#elif defined (_WIN32) && !defined (_WIN32_WCE)
|
||||
#elif defined (_WIN32)
|
||||
#include <sys/utime.h>
|
||||
#endif
|
||||
#ifdef __DJGPP__
|
||||
#include <dir.h>
|
||||
#include <utime.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
#include "curl/curl.h"
|
||||
@@ -72,8 +64,13 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid);
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 35, 0)
|
||||
int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow);
|
||||
#define XFERINFOFUNCTION
|
||||
#else
|
||||
int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Sender structure
|
||||
typedef struct filetx_s
|
||||
@@ -489,7 +486,6 @@ INT32 CL_CheckFiles(void)
|
||||
{
|
||||
INT32 i, j;
|
||||
char wadfilename[MAX_WADPATH];
|
||||
size_t packetsize = 0;
|
||||
size_t filestoload = 0;
|
||||
boolean downloadrequired = false;
|
||||
|
||||
@@ -513,7 +509,7 @@ INT32 CL_CheckFiles(void)
|
||||
|
||||
for (i = 0, j = mainwads+1; i < fileneedednum || j < numwadfiles;)
|
||||
{
|
||||
if (j < numwadfiles && !wadfiles[j]->important)
|
||||
if (j < numwadfiles && (!wadfiles[j]->important || wadfiles[j]->localfile))
|
||||
{
|
||||
// Unimportant on our side. still don't care.
|
||||
++j;
|
||||
@@ -562,7 +558,7 @@ INT32 CL_CheckFiles(void)
|
||||
CONS_Debug(DBG_NETPLAY, "searching for '%s' ", fileneeded[i].filename);
|
||||
|
||||
// Check in already loaded files
|
||||
for (j = mainwads+1; wadfiles[j]; j++)
|
||||
for (j = mainwads+1; j < numwadfiles; j++)
|
||||
{
|
||||
nameonly(strcpy(wadfilename, wadfiles[j]->filename));
|
||||
if (!stricmp(wadfilename, fileneeded[i].filename) &&
|
||||
@@ -574,8 +570,6 @@ INT32 CL_CheckFiles(void)
|
||||
}
|
||||
}
|
||||
|
||||
packetsize += nameonlylength(fileneeded[i].filename) + 22;
|
||||
|
||||
fileneeded[i].status = findfile(fileneeded[i].filename, fileneeded[i].md5sum, true);
|
||||
CONS_Debug(DBG_NETPLAY, "found %d\n", fileneeded[i].status);
|
||||
return 4;
|
||||
@@ -1142,7 +1136,7 @@ size_t nameonlylength(const char *s)
|
||||
|
||||
filestatus_t checkfilemd5(char *filename, const UINT8 *wantedmd5sum)
|
||||
{
|
||||
#if defined (NOMD5) || defined (_arch_dreamcast)
|
||||
#if defined (NOMD5)
|
||||
(void)wantedmd5sum;
|
||||
(void)filename;
|
||||
#else
|
||||
@@ -1194,11 +1188,7 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
|
||||
// if not found at all, just move on without doing anything
|
||||
|
||||
// finally check "." directory
|
||||
#ifdef _arch_dreamcast
|
||||
homecheck = filesearch(filename, "/cd", wantedmd5sum, completepath, 10);
|
||||
#else
|
||||
homecheck = filesearch(filename, ".", wantedmd5sum, completepath, 10);
|
||||
#endif
|
||||
|
||||
if (homecheck != FS_NOTFOUND) // if not found this time, fall back on the below return statement
|
||||
return homecheck; // otherwise return the result we got
|
||||
@@ -1214,6 +1204,18 @@ size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
|
||||
return written;
|
||||
}
|
||||
|
||||
#ifdef XFERINFOFUNCTION
|
||||
int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
|
||||
{
|
||||
(void)clientp;
|
||||
(void)ultotal;
|
||||
(void)ulnow; // Function prototype requires these but we won't use, so just discard
|
||||
curl_dlnow = dlnow;
|
||||
curl_dltotal = dltotal;
|
||||
getbytes = curl_dlnow / (time(NULL) - curl_starttime); // To-do: Make this more accurate???
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
|
||||
{
|
||||
(void)clientp;
|
||||
@@ -1224,6 +1226,7 @@ int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ul
|
||||
getbytes = curl_dlnow / (time(NULL) - curl_starttime); // To-do: Make this more accurate???
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CURLPrepareFile(const char* url, int dfilenum)
|
||||
{
|
||||
@@ -1253,7 +1256,11 @@ void CURLPrepareFile(const char* url, int dfilenum)
|
||||
curl_easy_setopt(http_handle, CURLOPT_URL, va("%s/%s", url, curl_realname));
|
||||
|
||||
// Only allow HTTP and HTTPS
|
||||
#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 85, 0)
|
||||
curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS_STR, "http,https");
|
||||
#else
|
||||
curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS);
|
||||
#endif
|
||||
|
||||
curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("SRB2Kart/v%d.%d", VERSION, SUBVERSION)); // Set user agent as some servers won't accept invalid user agents.
|
||||
|
||||
@@ -1277,7 +1284,11 @@ void CURLPrepareFile(const char* url, int dfilenum)
|
||||
curl_easy_setopt(http_handle, CURLOPT_WRITEDATA, curl_curfile->file);
|
||||
curl_easy_setopt(http_handle, CURLOPT_WRITEFUNCTION, curlwrite_data);
|
||||
curl_easy_setopt(http_handle, CURLOPT_NOPROGRESS, 0L);
|
||||
#ifdef XFERINFOFUNCTION
|
||||
curl_easy_setopt(http_handle, CURLOPT_XFERINFOFUNCTION, curlprogress_callbackx);
|
||||
#else
|
||||
curl_easy_setopt(http_handle, CURLOPT_PROGRESSFUNCTION, curlprogress_callback);
|
||||
#endif
|
||||
|
||||
curl_curfile->status = FS_DOWNLOADING;
|
||||
lastfilenum = dfilenum;
|
||||
|
||||
@@ -371,6 +371,7 @@ typedef struct player_s
|
||||
|
||||
angle_t viewrollangle;
|
||||
angle_t tilt;
|
||||
angle_t tilt_sprite;
|
||||
|
||||
// Mouse aiming, where the guy is looking at!
|
||||
// It is updated with cmd->aiming.
|
||||
@@ -415,6 +416,8 @@ typedef struct player_s
|
||||
UINT8 skincolor;
|
||||
|
||||
INT32 skin;
|
||||
INT32 localskin;
|
||||
boolean skinlocal;
|
||||
|
||||
UINT32 score; // player score
|
||||
fixed_t dashspeed; // dashing speed
|
||||
|
||||
+3
-11
@@ -43,12 +43,6 @@
|
||||
#include "r_draw.h" // translation colormap consts (for lua)
|
||||
#endif
|
||||
|
||||
#ifdef PC_DOS
|
||||
#include <stdio.h> // for snprintf
|
||||
//int snprintf(char *str, size_t n, const char *fmt, ...);
|
||||
int vsnprintf(char *str, size_t n, const char *fmt, va_list ap);
|
||||
#endif
|
||||
|
||||
// Free slot names
|
||||
// The crazy word-reading stuff uses these.
|
||||
static char *FREE_STATES[NUMSTATEFREESLOTS];
|
||||
@@ -1888,7 +1882,7 @@ static void readframe(MYFILE *f, INT32 num)
|
||||
{
|
||||
size_t z;
|
||||
boolean found = false;
|
||||
XBOXSTATIC char actiontocompare[32];
|
||||
char actiontocompare[32];
|
||||
|
||||
memset(actiontocompare, 0x00, sizeof(actiontocompare));
|
||||
strlcpy(actiontocompare, word2, sizeof (actiontocompare));
|
||||
@@ -3159,9 +3153,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||
char *word2;
|
||||
INT32 i;
|
||||
// do a copy of this for cross references probleme
|
||||
//XBOXSTATIC actionf_t saveactions[NUMSTATES];
|
||||
//XBOXSTATIC const char *savesprnames[NUMSPRITES];
|
||||
XBOXSTATIC const char *savesfxnames[NUMSFX];
|
||||
const char *savesfxnames[NUMSFX];
|
||||
|
||||
if (!deh_loaded)
|
||||
initfreeslots();
|
||||
@@ -3181,7 +3173,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||
dbg_line = -1; // start at -1 so the first line is 0.
|
||||
while (!myfeof(f))
|
||||
{
|
||||
XBOXSTATIC char origpos[128];
|
||||
char origpos[128];
|
||||
INT32 size = 0;
|
||||
char *traverse;
|
||||
|
||||
|
||||
+39
-2
@@ -37,7 +37,9 @@
|
||||
// length of IP strings
|
||||
#define IP_SIZE 21
|
||||
|
||||
consvar_t cv_discordrp = {"discordrp", "On", CV_SAVE|CV_CALL, CV_OnOff, DRPC_UpdatePresence, 0, NULL, NULL, 0, 0, NULL};
|
||||
static void Discordrp_OnChange(void);
|
||||
|
||||
consvar_t cv_discordrp = {"discordrp", "On", CV_SAVE|CV_CALL, CV_OnOff, Discordrp_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_discordstreamer = {"discordstreamer", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_discordasks = {"discordasks", "Yes", CV_SAVE|CV_CALL, CV_YesNo, DRPC_UpdatePresence, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -47,6 +49,8 @@ discordRequest_t *discordRequestList = NULL;
|
||||
|
||||
static char self_ip[IP_SIZE];
|
||||
|
||||
boolean drpc_init = false;
|
||||
|
||||
/*--------------------------------------------------
|
||||
static char *DRPC_XORIPString(const char *input)
|
||||
|
||||
@@ -315,6 +319,9 @@ void DRPC_RemoveRequest(discordRequest_t *removeRequest)
|
||||
--------------------------------------------------*/
|
||||
void DRPC_Init(void)
|
||||
{
|
||||
if (drpc_init || !cv_discordrp.value) return;
|
||||
|
||||
drpc_init = true;
|
||||
DiscordEventHandlers handlers;
|
||||
memset(&handlers, 0, sizeof(handlers));
|
||||
|
||||
@@ -325,10 +332,36 @@ void DRPC_Init(void)
|
||||
handlers.joinRequest = DRPC_HandleJoinRequest;
|
||||
|
||||
Discord_Initialize(DISCORD_APPID, &handlers, 1, NULL);
|
||||
I_AddExitFunc(Discord_Shutdown);
|
||||
I_AddExitFunc(DRPC_Shutdown);
|
||||
DRPC_UpdatePresence();
|
||||
}
|
||||
|
||||
void DRPC_Shutdown(void)
|
||||
{
|
||||
if (!drpc_init)
|
||||
{
|
||||
CONS_Printf("DiscordRPC never started\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CONS_Printf("Shutting down DiscordRPC\n");
|
||||
|
||||
Discord_Shutdown();
|
||||
drpc_init = false;
|
||||
}
|
||||
|
||||
static void Discordrp_OnChange(void)
|
||||
{
|
||||
if (cv_discordrp.value)
|
||||
{
|
||||
DRPC_UpdatePresence();
|
||||
}
|
||||
else
|
||||
{
|
||||
DRPC_Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static void DRPC_GotServerIP(UINT32 address)
|
||||
|
||||
@@ -402,6 +435,10 @@ static void DRPC_EmptyRequests(void)
|
||||
--------------------------------------------------*/
|
||||
void DRPC_UpdatePresence(void)
|
||||
{
|
||||
if (!cv_discordrp.value) return;
|
||||
|
||||
if (!drpc_init) DRPC_Init();
|
||||
|
||||
char detailstr[48+1];
|
||||
|
||||
char mapimg[8+1];
|
||||
|
||||
@@ -64,6 +64,13 @@ void DRPC_RemoveRequest(discordRequest_t *removeRequest);
|
||||
void DRPC_Init(void);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void DRPC_Shutdown(void);
|
||||
|
||||
Shutdown Discord Rich Presence if it was started at all.
|
||||
--------------------------------------------------*/
|
||||
void DRPC_Shutdown(void);
|
||||
|
||||
/*--------------------------------------------------
|
||||
void DRPC_UpdatePresence(void);
|
||||
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
#
|
||||
# djgppdos/makefile.cfg for SRB2/DOS
|
||||
#
|
||||
|
||||
#
|
||||
#now for the DOS stuff, go DOS!
|
||||
#
|
||||
|
||||
# options
|
||||
OPTS=-DPC_DOS
|
||||
WFLAGS+=-Wno-cast-qual
|
||||
NOHW=1
|
||||
NOHS=1
|
||||
PNG_CFLAGS=
|
||||
PNG_LDFLAGS=-lpng -lz
|
||||
|
||||
ifdef WATTCP
|
||||
OPTS+=-DWATTCP
|
||||
NOOBJDUMP=1
|
||||
endif
|
||||
|
||||
#ifdef DEBUGMODE
|
||||
LIBS=-lalld
|
||||
#else
|
||||
# LIBS=-lalleg
|
||||
#endif
|
||||
|
||||
ifndef NONET
|
||||
ifdef WATTCP
|
||||
LIBS+=-lwatt
|
||||
else
|
||||
LIBS+=-lsocket
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef RDB
|
||||
LIBS+=-lgdbst -ldzcom
|
||||
OPTS+=-DREMOTE_DEBUGGING
|
||||
endif
|
||||
|
||||
OBJS=$(OBJDIR)/i_video.o $(OBJDIR)/vid_vesa.o
|
||||
|
||||
# name of the exefile
|
||||
ifdef WATTCP
|
||||
EXENAME?=srb2dos.exe
|
||||
else
|
||||
EXENAME?=srb2w16.exe
|
||||
endif
|
||||
@@ -1,755 +0,0 @@
|
||||
/* bcd.c -- Brennan's CD-ROM Audio Playing Library
|
||||
by Brennan Underwood, http://brennan.home.ml.org/ */
|
||||
#include <dos.h>
|
||||
#include <dpmi.h>
|
||||
#include <go32.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include <unistd.h>
|
||||
#include <strings.h>
|
||||
#ifdef STANDALONE
|
||||
#include <conio.h> /* for getch() */
|
||||
#endif
|
||||
|
||||
#include "bcd.h"
|
||||
|
||||
typedef struct {
|
||||
int is_audio;
|
||||
int start, end, len;
|
||||
} Track;
|
||||
|
||||
static int mscdex_version;
|
||||
static int first_drive;
|
||||
static int num_tracks;
|
||||
static int lowest_track, highest_track;
|
||||
static int audio_length;
|
||||
|
||||
#ifdef STATIC_TRACKS
|
||||
static Track tracks[99];
|
||||
#else
|
||||
static Track *tracks;
|
||||
#endif
|
||||
|
||||
static int dos_mem_segment, dos_mem_selector = -1;
|
||||
|
||||
int _status, _error, _error_code;
|
||||
const char *_bcd_error = NULL;
|
||||
|
||||
#define RESET_ERROR (_error = _error_code = 0)
|
||||
#define ERROR_BIT (1 << 15)
|
||||
#define BUSY_BIT (1 << 9)
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/* I know 'typedef struct {} bleh' is a bad habit, but... */
|
||||
typedef struct {
|
||||
unsigned char len;
|
||||
unsigned char unit;
|
||||
unsigned char command;
|
||||
unsigned short status;
|
||||
unsigned char reserved[8];
|
||||
} ATTRPACK RequestHeader;
|
||||
|
||||
typedef struct {
|
||||
RequestHeader request_header;
|
||||
unsigned char descriptor;
|
||||
unsigned long address;
|
||||
unsigned short len;
|
||||
unsigned short secnum;
|
||||
unsigned long ptr;
|
||||
} ATTRPACK IOCTLI;
|
||||
|
||||
typedef struct {
|
||||
unsigned char control;
|
||||
unsigned char lowest;
|
||||
unsigned char highest;
|
||||
char total[4];
|
||||
} ATTRPACK DiskInfo;
|
||||
|
||||
typedef struct {
|
||||
unsigned char control;
|
||||
unsigned char track_number;
|
||||
char start[4];
|
||||
unsigned char info;
|
||||
} ATTRPACK TrackInfo;
|
||||
|
||||
typedef struct {
|
||||
RequestHeader request;
|
||||
unsigned char mode;
|
||||
unsigned long start;
|
||||
unsigned long len;
|
||||
} ATTRPACK PlayRequest;
|
||||
|
||||
typedef struct {
|
||||
RequestHeader request;
|
||||
} ATTRPACK StopRequest;
|
||||
|
||||
typedef struct {
|
||||
RequestHeader request;
|
||||
} ATTRPACK ResumeRequest;
|
||||
|
||||
typedef struct {
|
||||
unsigned char control;
|
||||
unsigned char input0;
|
||||
unsigned char volume0;
|
||||
unsigned char input1;
|
||||
unsigned char volume1;
|
||||
unsigned char input2;
|
||||
unsigned char volume2;
|
||||
unsigned char input3;
|
||||
unsigned char volume3;
|
||||
} ATTRPACK VolumeRequest;
|
||||
|
||||
typedef struct {
|
||||
unsigned char control;
|
||||
unsigned char fn;
|
||||
} ATTRPACK LockRequest;
|
||||
|
||||
typedef struct {
|
||||
unsigned char control;
|
||||
unsigned char mbyte;
|
||||
} ATTRPACK MediaChangedRequest;
|
||||
|
||||
typedef struct {
|
||||
unsigned char control;
|
||||
unsigned long status;
|
||||
} ATTRPACK StatusRequest;
|
||||
|
||||
typedef struct {
|
||||
unsigned char control;
|
||||
unsigned char mode;
|
||||
unsigned long loc;
|
||||
} ATTRPACK PositionRequest;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
const char *bcd_error(void) {
|
||||
static char retstr[132];
|
||||
const char *errorcodes[] = {
|
||||
"Write-protect violation",
|
||||
"Unknown unit",
|
||||
"Drive not ready",
|
||||
"Unknown command",
|
||||
"CRC error",
|
||||
"Bad drive request structure length",
|
||||
"Seek error",
|
||||
"Unknown media",
|
||||
"Sector not found",
|
||||
"Printer out of paper: world coming to an end",/* I mean really, on a CD? */
|
||||
"Write fault",
|
||||
"Read fault",
|
||||
"General failure",
|
||||
"Reserved",
|
||||
"Reserved",
|
||||
"Invalid disk change"
|
||||
};
|
||||
*retstr = 0;
|
||||
if (_error != 0) {
|
||||
strcat(retstr, "Device error: ");
|
||||
if (_error_code < 0 || _error_code > 0xf)
|
||||
strcat(retstr, "Invalid error");
|
||||
else
|
||||
strcat(retstr, errorcodes[_error_code]);
|
||||
strcat(retstr, " ");
|
||||
}
|
||||
if (_bcd_error != NULL) {
|
||||
if (*retstr) strcat(retstr, ", ");
|
||||
strcat(retstr, "BCD error: ");
|
||||
strcat(retstr, _bcd_error);
|
||||
}
|
||||
return retstr;
|
||||
}
|
||||
|
||||
/* DOS IOCTL w/ command block */
|
||||
static void bcd_ioctl(IOCTLI *ioctli, void *command, int len) {
|
||||
int ioctli_len = sizeof (IOCTLI);
|
||||
unsigned long command_address = dos_mem_segment << 4;
|
||||
__dpmi_regs regs;
|
||||
|
||||
memset(®s, 0, sizeof regs);
|
||||
regs.x.es = (__tb >> 4) & 0xffff;
|
||||
regs.x.ax = 0x1510;
|
||||
regs.x.bx = __tb & 0xf;
|
||||
regs.x.cx = first_drive;
|
||||
ioctli->address = dos_mem_segment << 16;
|
||||
ioctli->len = len;
|
||||
dosmemput(ioctli, ioctli_len, __tb); /* put ioctl into dos area */
|
||||
dosmemput(command, len, command_address); /* and command too */
|
||||
if (__dpmi_int(0x2f, ®s) == -1) {
|
||||
_bcd_error = "__dpmi_int() failed";
|
||||
return;
|
||||
}
|
||||
dosmemget(__tb, ioctli_len, ioctli); /* retrieve results */
|
||||
dosmemget(command_address, len, command);
|
||||
_status = ioctli->request_header.status;
|
||||
if (_status & ERROR_BIT) {
|
||||
_error = TRUE;
|
||||
_error_code = _status & 0xff;
|
||||
} else {
|
||||
_error = FALSE;
|
||||
_error_code = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* no command block */
|
||||
FUNCINLINE static ATTRINLINE void bcd_ioctl2(void *cmd, int len) {
|
||||
__dpmi_regs regs;
|
||||
memset(®s, 0, sizeof regs);
|
||||
regs.x.es = (__tb >> 4) & 0xffff;
|
||||
regs.x.ax = 0x1510;
|
||||
regs.x.bx = __tb & 0xf;
|
||||
regs.x.cx = first_drive;
|
||||
dosmemput(cmd, len, __tb); /* put ioctl block in dos arena */
|
||||
if (__dpmi_int(0x2f, ®s) == -1) {
|
||||
_bcd_error = "__dpmi_int() failed";
|
||||
return;
|
||||
}
|
||||
/* I hate to have no error capability for ioctl2 but the command block
|
||||
doesn't necessarily have a status field */
|
||||
RESET_ERROR;
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE int red2hsg(char *r) {
|
||||
return r[0] + r[1]*75 + r[2]*4500 - 150;
|
||||
}
|
||||
|
||||
int bcd_now_playing(void) {
|
||||
int i, loc = bcd_audio_position();
|
||||
_bcd_error = NULL;
|
||||
if (!bcd_audio_busy()) {
|
||||
_bcd_error = "Audio not playing";
|
||||
return 0;
|
||||
}
|
||||
if (
|
||||
#ifndef STATIC_TRACKS
|
||||
tracks == NULL &&
|
||||
#endif
|
||||
!bcd_get_audio_info())
|
||||
return 0;
|
||||
for (i = lowest_track; i <= highest_track; i++) {
|
||||
if (loc >= tracks[i].start && loc <= tracks[i].end) return i;
|
||||
}
|
||||
/* some bizarre location? */
|
||||
_bcd_error = "Head outside of bounds";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* handles the setup for CD-ROM audio interface */
|
||||
int bcd_open(void) {
|
||||
__dpmi_regs regs;
|
||||
_bcd_error = NULL;
|
||||
|
||||
/* disk I/O wouldn't work anyway if you set sizeof tb this low, but... */
|
||||
if (_go32_info_block.size_of_transfer_buffer < 4096) {
|
||||
_bcd_error = "Transfer buffer too small";
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(®s, 0, sizeof regs);
|
||||
regs.x.ax = 0x1500;
|
||||
regs.x.bx = 0x0;
|
||||
__dpmi_int(0x2f, ®s);
|
||||
if (regs.x.bx == 0) { /* abba no longer lives */
|
||||
_bcd_error = "MSCDEX not found";
|
||||
return 0;
|
||||
}
|
||||
|
||||
first_drive = regs.x.cx; /* use the first drive */
|
||||
|
||||
/* check for mscdex at least 2.0 */
|
||||
memset(®s, 0, sizeof regs);
|
||||
regs.x.ax = 0x150C;
|
||||
__dpmi_int(0x2f, ®s);
|
||||
if (regs.x.bx == 0) {
|
||||
_bcd_error = "MSCDEX version < 2.0";
|
||||
return 0;
|
||||
}
|
||||
mscdex_version = regs.x.bx;
|
||||
|
||||
/* allocate 256 bytes of dos memory for the command blocks */
|
||||
if ((dos_mem_segment = __dpmi_allocate_dos_memory(16, &dos_mem_selector))<0) {
|
||||
_bcd_error = "Could not allocate 256 bytes of DOS memory";
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mscdex_version;
|
||||
}
|
||||
|
||||
/* Shuts down CD-ROM audio interface */
|
||||
int bcd_close(void) {
|
||||
_bcd_error = NULL;
|
||||
if (dos_mem_selector != -1) {
|
||||
__dpmi_free_dos_memory(dos_mem_selector);
|
||||
dos_mem_selector = -1;
|
||||
}
|
||||
#ifndef STATIC_TRACKS
|
||||
if (tracks) free(tracks);
|
||||
tracks = NULL;
|
||||
#endif
|
||||
RESET_ERROR;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bcd_open_door(void) {
|
||||
IOCTLI ioctli;
|
||||
char eject = 0;
|
||||
_bcd_error = NULL;
|
||||
memset(&ioctli, 0, sizeof ioctli);
|
||||
ioctli.request_header.len = sizeof ioctli;
|
||||
ioctli.request_header.command = 12;
|
||||
ioctli.len = 1;
|
||||
bcd_ioctl(&ioctli, &eject, sizeof eject);
|
||||
if (_error) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bcd_close_door(void) {
|
||||
IOCTLI ioctli;
|
||||
char closeit = 5;
|
||||
_bcd_error = NULL;
|
||||
memset(&ioctli, 0, sizeof ioctli);
|
||||
ioctli.request_header.len = sizeof ioctli;
|
||||
ioctli.request_header.command = 12;
|
||||
ioctli.len = 1;
|
||||
bcd_ioctl(&ioctli, &closeit, sizeof closeit);
|
||||
if (_error) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bcd_lock(int fn) {
|
||||
IOCTLI ioctli;
|
||||
LockRequest req;
|
||||
_bcd_error = NULL;
|
||||
memset(&ioctli, 0, sizeof ioctli);
|
||||
memset(&req, 0, sizeof req);
|
||||
ioctli.request_header.len = sizeof ioctli;
|
||||
ioctli.request_header.command = 12;
|
||||
ioctli.len = sizeof req;
|
||||
req.control = 1;
|
||||
req.fn = fn ? 1 : 0;
|
||||
bcd_ioctl(&ioctli, &req, sizeof req);
|
||||
if (_error) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int bcd_disc_changed(void) {
|
||||
IOCTLI ioctli;
|
||||
MediaChangedRequest req;
|
||||
_bcd_error = NULL;
|
||||
memset(&ioctli, 0, sizeof ioctli);
|
||||
memset(&req, 0, sizeof req);
|
||||
ioctli.request_header.len = sizeof ioctli;
|
||||
ioctli.request_header.command = 3;
|
||||
ioctli.len = sizeof req;
|
||||
req.control = 9;
|
||||
bcd_ioctl(&ioctli, &req, sizeof req);
|
||||
return req.mbyte;
|
||||
}
|
||||
|
||||
int bcd_reset(void) {
|
||||
IOCTLI ioctli;
|
||||
char reset = 2;
|
||||
_bcd_error = NULL;
|
||||
|
||||
memset(&ioctli, 0, sizeof ioctli);
|
||||
ioctli.request_header.len = sizeof ioctli;
|
||||
ioctli.request_header.command = 12;
|
||||
ioctli.len = 1;
|
||||
bcd_ioctl(&ioctli, &reset, sizeof reset);
|
||||
if (_error) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bcd_device_status(void) {
|
||||
IOCTLI ioctli;
|
||||
StatusRequest req;
|
||||
_bcd_error = NULL;
|
||||
memset(&ioctli, 0, sizeof ioctli);
|
||||
memset(&req, 0, sizeof req);
|
||||
ioctli.request_header.len = sizeof ioctli; // ok
|
||||
ioctli.request_header.command = 3;
|
||||
ioctli.len = sizeof req;
|
||||
req.control = 6;
|
||||
bcd_ioctl(&ioctli, &req, sizeof req);
|
||||
return req.status;
|
||||
}
|
||||
|
||||
static inline int bcd_get_status_word(void) {
|
||||
IOCTLI ioctli;
|
||||
DiskInfo disk_info;
|
||||
|
||||
/* get cd info as an excuse to get a look at the status word */
|
||||
memset(&disk_info, 0, sizeof disk_info);
|
||||
memset(&ioctli, 0, sizeof ioctli);
|
||||
|
||||
ioctli.request_header.len = 26;
|
||||
ioctli.request_header.command = 3;
|
||||
ioctli.len = 7;
|
||||
disk_info.control = 10;
|
||||
bcd_ioctl(&ioctli, &disk_info, sizeof disk_info);
|
||||
return _status;
|
||||
}
|
||||
|
||||
int bcd_audio_busy(void) {
|
||||
_bcd_error = NULL;
|
||||
/* If the door is open, then the head is busy, and so the busy bit is
|
||||
on. It is not, however, playing audio. */
|
||||
if (bcd_device_status() & BCD_DOOR_OPEN)
|
||||
return 0;
|
||||
|
||||
bcd_get_status_word();
|
||||
if (_error) return -1;
|
||||
return (_status & BUSY_BIT) ? 1 : 0;
|
||||
}
|
||||
|
||||
int bcd_audio_position(void) {
|
||||
IOCTLI ioctli;
|
||||
PositionRequest req;
|
||||
_bcd_error = NULL;
|
||||
memset(&ioctli, 0, sizeof ioctli);
|
||||
memset(&req, 0, sizeof req);
|
||||
ioctli.request_header.len = sizeof ioctli;
|
||||
ioctli.request_header.command = 3;
|
||||
ioctli.len = sizeof req;
|
||||
req.control = 1;
|
||||
bcd_ioctl(&ioctli, &req, sizeof req);
|
||||
return req.loc;
|
||||
}
|
||||
|
||||
/* Internal function to get track info */
|
||||
static inline void bcd_get_track_info(int n, Track *t) {
|
||||
IOCTLI ioctli;
|
||||
TrackInfo info;
|
||||
|
||||
memset(&ioctli, 0, sizeof ioctli);
|
||||
memset(&info, 0, sizeof info);
|
||||
ioctli.request_header.len = sizeof ioctli;
|
||||
ioctli.request_header.command = 3;
|
||||
info.control = 11;
|
||||
info.track_number = n;
|
||||
bcd_ioctl(&ioctli, &info, sizeof info);
|
||||
t->start = red2hsg(info.start);
|
||||
if (info.info & 64)
|
||||
t->is_audio = 0;
|
||||
else
|
||||
t->is_audio = 1;
|
||||
}
|
||||
|
||||
int bcd_get_audio_info(void) {
|
||||
IOCTLI ioctli;
|
||||
DiskInfo disk_info;
|
||||
int i;
|
||||
|
||||
|
||||
_bcd_error = NULL;
|
||||
#ifndef STATIC_TRACKS
|
||||
if (tracks) free(tracks);
|
||||
tracks = NULL;
|
||||
#endif
|
||||
|
||||
memset(&disk_info, 0, sizeof disk_info);
|
||||
memset(&ioctli, 0, sizeof ioctli);
|
||||
|
||||
ioctli.request_header.len = 26;
|
||||
ioctli.request_header.command = 3;
|
||||
ioctli.len = 7;
|
||||
disk_info.control = 10;
|
||||
bcd_ioctl(&ioctli, &disk_info, sizeof disk_info);
|
||||
if (_error) return 0;
|
||||
|
||||
lowest_track = disk_info.lowest;
|
||||
highest_track = disk_info.highest;
|
||||
num_tracks = disk_info.highest - disk_info.lowest + 1;
|
||||
|
||||
#ifndef STATIC_TRACKS
|
||||
//tracks = calloc(num_tracks, sizeof (Track));
|
||||
/* alloc max space in order to attempt to avoid possible overrun bug */
|
||||
tracks = calloc(highest_track+1, sizeof (Track));
|
||||
if (tracks == NULL) {
|
||||
_bcd_error = "Out of memory allocating tracks\n";
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* get track starts */
|
||||
for (i = lowest_track; i <= highest_track; i++)
|
||||
bcd_get_track_info(i, tracks+i);
|
||||
|
||||
/* figure out track ends */
|
||||
for (i = lowest_track; i < highest_track; i++)
|
||||
tracks[i].end = tracks[i+1].start-1;
|
||||
audio_length = red2hsg(disk_info.total);
|
||||
tracks[i].end = audio_length;
|
||||
for (i = lowest_track; i <= highest_track; i++)
|
||||
tracks[i].len = tracks[i].end - tracks[i].start;
|
||||
|
||||
return num_tracks;
|
||||
}
|
||||
|
||||
int bcd_get_track_address(int trackno, int *start, int *len) {
|
||||
_bcd_error = NULL;
|
||||
//if (trackno >= num_tracks+1 || trackno <= 0) {
|
||||
if (trackno < lowest_track || trackno > highest_track) {
|
||||
_bcd_error = "Track out of range";
|
||||
*start = *len = 0;
|
||||
return 0;
|
||||
}
|
||||
*start = tracks[trackno].start;
|
||||
*len = tracks[trackno].len;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bcd_track_is_audio(int trackno) {
|
||||
//if (trackno >= num_tracks+1 || trackno <= 0) {
|
||||
if (trackno < lowest_track || trackno > highest_track) {
|
||||
_bcd_error = "Track out of range";
|
||||
return 0;
|
||||
}
|
||||
return tracks[trackno].is_audio;
|
||||
}
|
||||
|
||||
int bcd_set_volume(int volume) {
|
||||
IOCTLI ioctli;
|
||||
VolumeRequest v;
|
||||
|
||||
_bcd_error = NULL;
|
||||
if (volume > 255) volume = 255;
|
||||
else if (volume < 0) volume = 0;
|
||||
memset(&ioctli, 0, sizeof ioctli);
|
||||
ioctli.request_header.len = sizeof ioctli;
|
||||
ioctli.request_header.command = 12;
|
||||
ioctli.len = sizeof v;
|
||||
v.control = 3;
|
||||
v.volume0 = volume;
|
||||
v.input0 = 0;
|
||||
v.volume1 = volume;
|
||||
v.input1 = 1;
|
||||
v.volume2 = volume;
|
||||
v.input2 = 2;
|
||||
v.volume3 = volume;
|
||||
v.input3 = 3;
|
||||
|
||||
bcd_ioctl(&ioctli, &v, sizeof v);
|
||||
if (_error) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bcd_play(int location, int frames) {
|
||||
PlayRequest cmd;
|
||||
memset(&cmd, 0, sizeof cmd);
|
||||
|
||||
_bcd_error = NULL;
|
||||
/* the following should be in user code, but it'll fail otherwise */
|
||||
if (bcd_audio_busy())
|
||||
bcd_stop();
|
||||
|
||||
cmd.request.len = sizeof cmd;
|
||||
cmd.request.command = 132;
|
||||
cmd.start = location;
|
||||
cmd.len = frames;
|
||||
bcd_ioctl2(&cmd, sizeof cmd);
|
||||
if (_error) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bcd_play_track(int trackno) {
|
||||
_bcd_error = NULL;
|
||||
if (!bcd_get_audio_info()) return 0;
|
||||
|
||||
if (trackno < lowest_track || trackno > highest_track) {
|
||||
_bcd_error = "Track out of range";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (! tracks[trackno].is_audio) {
|
||||
_bcd_error = "Not an audio track";
|
||||
return 0;
|
||||
}
|
||||
|
||||
return bcd_play(tracks[trackno].start, tracks[trackno].len);
|
||||
}
|
||||
|
||||
int bcd_stop(void) {
|
||||
StopRequest cmd;
|
||||
_bcd_error = NULL;
|
||||
memset(&cmd, 0, sizeof cmd);
|
||||
cmd.request.len = sizeof cmd;
|
||||
cmd.request.command = 133;
|
||||
bcd_ioctl2(&cmd, sizeof cmd);
|
||||
if (_error) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bcd_resume(void) {
|
||||
ResumeRequest cmd;
|
||||
_bcd_error = NULL;
|
||||
memset(&cmd, 0, sizeof cmd);
|
||||
cmd.request.len = sizeof cmd;
|
||||
cmd.request.command = 136;
|
||||
bcd_ioctl2(&cmd, sizeof cmd);
|
||||
if (_error) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef STANDALONE
|
||||
static char *card(int c) {
|
||||
return c == 1 ? "" : "s";
|
||||
}
|
||||
|
||||
static void print_hsg(int hsg) {
|
||||
int hours, minutes, seconds;
|
||||
seconds = hsg / 75;
|
||||
minutes = seconds / 60;
|
||||
seconds %= 60;
|
||||
hours = minutes / 60;
|
||||
minutes %= 60;
|
||||
printf("%2d:%02d:%02d", hours, minutes, seconds);
|
||||
}
|
||||
|
||||
static void print_binary(int v, int len) {
|
||||
for (;len;len--)
|
||||
printf("%d", (v & (1 << len)) ? 1 : 0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int i, n1, n2, t;
|
||||
|
||||
if (!bcd_open()) {
|
||||
fprintf(stderr, "Couldn't open CD-ROM drive. %s\n", bcd_error());
|
||||
exit(0);
|
||||
}
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (*argv[i] == '-') strcpy(argv[i], argv[i]+1);
|
||||
if (!strcmp(argv[i], "open") || !strcmp(argv[i], "eject")) {
|
||||
bcd_open_door();
|
||||
} else if (!strcmp(argv[i], "close")) {
|
||||
bcd_close_door();
|
||||
} else if (!strcmp(argv[i], "sleep")) {
|
||||
if (++i >= argc) break;
|
||||
sleep(atoi(argv[i]));
|
||||
} else if (!strcmp(argv[i], "list")) {
|
||||
int nd = 0, na = 0, audio_time = 0;
|
||||
if (!bcd_get_audio_info()) {
|
||||
printf("Error getting audio info\n");
|
||||
} else if (lowest_track == 0) {
|
||||
printf("No audio tracks\n");
|
||||
} else {
|
||||
for (t = lowest_track; t <= highest_track; t++) {
|
||||
printf("Track %2d: ", t);
|
||||
print_hsg(tracks[t].start);
|
||||
printf(" -> ");
|
||||
print_hsg(tracks[t].end);
|
||||
printf(" (");
|
||||
print_hsg(tracks[t].len);
|
||||
if (tracks[t].is_audio) {
|
||||
na++;
|
||||
printf(") audio");
|
||||
audio_time += tracks[t].len;
|
||||
} else {
|
||||
nd++;
|
||||
printf(") data ");
|
||||
}
|
||||
printf(" (HSG: %06d->%06d)\n", tracks[t].start, tracks[t].end);
|
||||
}
|
||||
printf("%d audio track%s, %d data track%s\n", na, card(na), nd, card(nd));
|
||||
if (audio_time) {
|
||||
printf("Audio time: ");
|
||||
print_hsg(audio_time);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(argv[i], "lock")) {
|
||||
bcd_lock(1);
|
||||
} else if (!strcmp(argv[i], "pladdr")) {
|
||||
if (++i >= argc) break;
|
||||
n1 = atoi(argv[i]);
|
||||
if (++i >= argc) break;
|
||||
n2 = atoi(argv[i]);
|
||||
printf("Playing frame %d to frame %d\n", n1, n2);
|
||||
bcd_play(n1, n2-n1);
|
||||
} else if (!strcmp(argv[i], "play")) {
|
||||
if (++i >= argc) break;
|
||||
if (bcd_audio_busy()) {
|
||||
bcd_stop();
|
||||
delay(1000);
|
||||
}
|
||||
n1 = atoi(argv[i]);
|
||||
printf("Playing track %d\n", n1);
|
||||
bcd_play_track(n1);
|
||||
} else if (!strcmp(argv[i], "reset")) {
|
||||
bcd_reset();
|
||||
} else if (!strcmp(argv[i], "resume")) {
|
||||
bcd_resume();
|
||||
} else if (!strcmp(argv[i], "status")) {
|
||||
int s;
|
||||
s = bcd_device_status();
|
||||
printf("MSCDEX version %d.%d\n", mscdex_version >> 8,
|
||||
mscdex_version & 0xff);
|
||||
printf("Device status word '");
|
||||
print_binary(s, 16);
|
||||
printf("'\nDoor is %sopen\n", s & BCD_DOOR_OPEN ? "" : "not ");
|
||||
printf("Door is %slocked\n", s & BCD_DOOR_UNLOCKED ? "not " : "");
|
||||
printf("Audio is %sbusy\n", bcd_audio_busy() ? "" : "not ");
|
||||
s = bcd_disc_changed();
|
||||
if (s == BCD_DISC_UNKNOWN) printf("Media change status unknown\n");
|
||||
else printf("Media has %schanged\n",
|
||||
(s == BCD_DISC_CHANGED) ? "" : "not ");
|
||||
} else if (!strcmp(argv[i], "stop")) {
|
||||
bcd_stop();
|
||||
} else if (!strcmp(argv[i], "unlock")) {
|
||||
bcd_lock(0);
|
||||
} else if (!strcmp(argv[i], "volume")) {
|
||||
bcd_set_volume(atoi(argv[++i]));
|
||||
} else if (!strcmp(argv[i], "wait")) {
|
||||
while (bcd_audio_busy()) {
|
||||
int n = bcd_now_playing();
|
||||
if (n == 0) break;
|
||||
printf("%2d: ", n);
|
||||
print_hsg(bcd_audio_position() - tracks[n].start);
|
||||
printf("\r");
|
||||
fflush(stdout);
|
||||
delay(100);
|
||||
if (kbhit() && getch() == 27) break;
|
||||
}
|
||||
printf("\n");
|
||||
} else if (!strcmp(argv[i], "help") || !strcmp(argv[i], "usage")) {
|
||||
printf("BCD version %x.%x\n" \
|
||||
"Usage: BCD {commands}\n" \
|
||||
"Valid commands:\n" \
|
||||
"\tclose - close door/tray\n" \
|
||||
"\tdelay {n} - delay {n} seconds\n" \
|
||||
"\tlist - list track info\n" \
|
||||
"\tlock - lock door/tray\n" \
|
||||
"\topen - open door/tray\n" \
|
||||
"\tpladdr {n1} {n2}- play frame {n1} to {n2}\n" \
|
||||
"\tplay {n} - play track {n}\n" \
|
||||
"\treset - reset the drive\n" \
|
||||
"\tresume - resume from last stop\n" \
|
||||
"\tstatus - show drive status\n" \
|
||||
"\tstop - stop audio playback\n" \
|
||||
"\tunlock - unlock door/tray\n" \
|
||||
"\tvolume {n} - set volume to {n} where 0 <= {n} <= 255\n",
|
||||
BCD_VERSION >> 8, BCD_VERSION & 0xff);
|
||||
} else
|
||||
printf("Unknown command '%s'\n", argv[i]);
|
||||
if (_error || _bcd_error) printf("%s\n", bcd_error());
|
||||
}
|
||||
bcd_close();
|
||||
exit(0);
|
||||
}
|
||||
#endif
|
||||
@@ -1,90 +0,0 @@
|
||||
/* bcd.h -- header file for BCD, a CD-ROM audio playing library for DJGPP
|
||||
by Brennan Underwood, http://brennan.home.ml.org/ */
|
||||
#ifndef _BCD_H
|
||||
#define _BCD_H
|
||||
|
||||
#define BCD_VERSION 0x0103
|
||||
|
||||
/* Installation and setup functions */
|
||||
/* Call this first! */
|
||||
int bcd_open(void);
|
||||
/* Call before exit. */
|
||||
int bcd_close(void);
|
||||
|
||||
/* open door, unlocking first if necessary */
|
||||
int bcd_open_door(void);
|
||||
/* close door */
|
||||
int bcd_close_door(void);
|
||||
|
||||
/* pass 1 to lock door, 0 to unlock */
|
||||
int bcd_lock(int);
|
||||
|
||||
/* returns one of the following 3 #defined symbols */
|
||||
int bcd_disc_changed(void);
|
||||
#define BCD_DISC_CHANGED 0xff
|
||||
#define BCD_DISC_NOT_CHANGED 1
|
||||
#define BCD_DISC_UNKNOWN 0
|
||||
|
||||
/* perform a device reset */
|
||||
int bcd_reset(void);
|
||||
|
||||
/* compare the returned status int to the following bits */
|
||||
int bcd_device_status(void);
|
||||
#define BCD_DOOR_OPEN 1
|
||||
#define BCD_DOOR_UNLOCKED 2
|
||||
#define BCD_SUPPORT_COOKED 4
|
||||
#define BCD_READ_ONLY 8
|
||||
#define BCD_DATA_READ_ONLY 16
|
||||
#define BCD_SUPPORT_INTERLEAVE 32
|
||||
|
||||
/* returns 1 if audio is currently playing, 0 otherwise. -1 on error */
|
||||
int bcd_audio_busy(void);
|
||||
/* current head position in frames */
|
||||
int bcd_audio_position(void);
|
||||
/* convenience function, if audio busy, returns track# playing now */
|
||||
int bcd_now_playing(void);
|
||||
|
||||
/* query MSCDEX for track list when disc changed or just starting up */
|
||||
int bcd_get_audio_info(void);
|
||||
/* get a particular track's info */
|
||||
int bcd_get_track_address(int trackno, int *start, int *len);
|
||||
/* check for track's audio/data status */
|
||||
int bcd_track_is_audio(int trackno);
|
||||
/* play a particular track from beginning to end */
|
||||
int bcd_play_track(int tracknum);
|
||||
/* play an arbitrary section of audio for an arbitrary length of time */
|
||||
int bcd_play(int start, int len);
|
||||
/* set the output volume. pass a parameter from 0-255 */
|
||||
int bcd_set_volume(int);
|
||||
/* stop and pause are equivalent */
|
||||
int bcd_stop(void);
|
||||
#define bcd_pause bcd_stop
|
||||
int bcd_resume(void);
|
||||
|
||||
/* Troubleshooting */
|
||||
/* Returns a human readable description of the last error encountered */
|
||||
const char *bcd_error(void);
|
||||
extern int _error_code;
|
||||
/* If you are mad enough play the Rach 3, I mean parse _error_code yourself */
|
||||
#define BCD_DE_WRITE_PROTECT 0
|
||||
#define BCD_DE_UNKNOWN_UNIT 1
|
||||
#define BCD_DE_DRIVE_NOT_READY 2
|
||||
#define BCD_DE_UNKNOWN_COMMAND 3
|
||||
#define BCD_DE_CRC_ERROR 4
|
||||
#define BCD_DE_STRUCT_LEN 5
|
||||
#define BCD_DE_SEEK_ERROR 6
|
||||
#define BCD_DE_UNKNOWN_MEDIA 7
|
||||
#define BCD_DE_SECTOR_NOT_FOUND 8
|
||||
#define BCD_DE_OUT_OF_PAPER 9
|
||||
#define BCD_DE_WRITE_FAULT 10
|
||||
#define BCD_DE_READ_FAULT 11
|
||||
#define BCD_DE_GENERAL_FAILURE 12
|
||||
#define BCD_DE_INVALID_DISK_CHANGE 15
|
||||
/* set by BCD itself, for stuff like "Out of memory" */
|
||||
extern const char *_bcd_error;
|
||||
|
||||
/* uncomment this line to force BCD to use a statically allocated
|
||||
Track array instead of using malloc */
|
||||
#define STATIC_TRACKS
|
||||
|
||||
#endif
|
||||
@@ -1,445 +0,0 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief cd music interface (uses bcd library)
|
||||
|
||||
// Alam_GBC: I hate you, Brennan Underwood :)
|
||||
#include "../doomtype.h"
|
||||
#include "bcd.c"
|
||||
//#include "bcd.h" // CD-Audio library by Brennan Underwood
|
||||
|
||||
#include "../doomdef.h"
|
||||
#include "../i_sound.h"
|
||||
#include "../command.h"
|
||||
#include "../i_system.h"
|
||||
#include "../s_sound.h"
|
||||
|
||||
// ------
|
||||
// protos
|
||||
// ------
|
||||
static void Command_Cd_f (void);
|
||||
|
||||
|
||||
//======================================================================
|
||||
// CD AUDIO MUSIC SUBSYSTEM
|
||||
//======================================================================
|
||||
|
||||
UINT8 cdaudio_started=0; // for system startup/shutdown
|
||||
|
||||
#define MAX_CD_TRACKS 256
|
||||
static boolean cdPlaying = false;
|
||||
static int cdPlayTrack; // when cdPlaying is true
|
||||
static boolean cdLooping = false;
|
||||
static UINT8 cdRemap[MAX_CD_TRACKS];
|
||||
static boolean cdEnabled=true; // cd info available
|
||||
static boolean cdValid; // true when last cd audio info was ok
|
||||
static boolean wasPlaying;
|
||||
static int cdVolume=0; // current cd volume (0-31)
|
||||
|
||||
// 0-31 like Music & Sfx, though CD hardware volume is 0-255.
|
||||
consvar_t cd_volume = {"cd_volume","18",CV_SAVE,soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// allow Update for next/loop track
|
||||
// some crap cd drivers take up to
|
||||
// a second for a simple 'busy' check..
|
||||
// (on those Update can be disabled)
|
||||
consvar_t cdUpdate = {"cd_update","1",CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
||||
// hour,minutes,seconds
|
||||
FUNCINLINE static ATTRINLINE char *hms(int hsg)
|
||||
{
|
||||
int hours, minutes, seconds;
|
||||
static char s[9];
|
||||
|
||||
seconds = hsg / 75;
|
||||
minutes = seconds / 60;
|
||||
seconds %= 60;
|
||||
hours = minutes / 60;
|
||||
minutes %= 60;
|
||||
if (hours>0)
|
||||
sprintf (s, "%d:%02d:%02d", hours, minutes, seconds);
|
||||
else
|
||||
sprintf (s, "%2d:%02d", minutes, seconds);
|
||||
return s;
|
||||
}
|
||||
|
||||
static void Command_Cd_f (void)
|
||||
{
|
||||
const char * s;
|
||||
int i,j;
|
||||
|
||||
if (!cdaudio_started)
|
||||
return;
|
||||
|
||||
if (COM_Argc()<2)
|
||||
{
|
||||
CONS_Printf ("cd [on] [off] [remap] [reset] [open]\n"
|
||||
" [info] [play <track>] [loop <track>]\n"
|
||||
" [stop] [resume]\n");
|
||||
return;
|
||||
}
|
||||
|
||||
s = COM_Argv(1);
|
||||
|
||||
// activate cd music
|
||||
if (!strncmp(s,"on",2))
|
||||
{
|
||||
cdEnabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// stop/deactivate cd music
|
||||
if (!strncmp(s,"off",3))
|
||||
{
|
||||
if (cdPlaying)
|
||||
I_StopCD ();
|
||||
cdEnabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// remap tracks
|
||||
if (!strncmp(s,"remap",5))
|
||||
{
|
||||
i = COM_Argc() - 2;
|
||||
if (i <= 0)
|
||||
{
|
||||
CONS_Printf ("CD tracks remapped in that order :\n");
|
||||
for (j = 1; j < MAX_CD_TRACKS; j++)
|
||||
if (cdRemap[j] != j)
|
||||
CONS_Printf (" %2d -> %2d\n", j, cdRemap[j]);
|
||||
return;
|
||||
}
|
||||
for (j = 1; j <= i; j++)
|
||||
cdRemap[j] = atoi (COM_Argv (j+1));
|
||||
return;
|
||||
}
|
||||
|
||||
// reset the CD driver, useful on some odd cd's
|
||||
if (!strncmp(s,"reset",5))
|
||||
{
|
||||
cdEnabled = true;
|
||||
if (cdPlaying)
|
||||
I_StopCD ();
|
||||
for (i = 0; i < MAX_CD_TRACKS; i++)
|
||||
cdRemap[i] = i;
|
||||
bcd_reset ();
|
||||
cdValid = bcd_get_audio_info ();
|
||||
return;
|
||||
}
|
||||
|
||||
// any other command is not allowed until we could retrieve cd information
|
||||
if (!cdValid)
|
||||
{
|
||||
CONS_Printf ("CD is not ready.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strncmp(s,"open",4))
|
||||
{
|
||||
if (cdPlaying)
|
||||
I_StopCD ();
|
||||
bcd_open_door();
|
||||
cdValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strncmp(s,"info",4))
|
||||
{
|
||||
int totaltime = 0;
|
||||
|
||||
if (!bcd_get_audio_info())
|
||||
{
|
||||
CONS_Printf ("Error getting audio info: %s\n",bcd_error());
|
||||
cdValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
cdValid = true;
|
||||
|
||||
if (lowest_track == 0)
|
||||
CONS_Printf ("No audio tracks\n");
|
||||
else
|
||||
{
|
||||
// display list of tracks
|
||||
// highlight current playing track
|
||||
for (i=lowest_track; i <= highest_track; i++)
|
||||
{
|
||||
CONS_Printf ("%s%2d. %s %s\n",
|
||||
cdPlaying && (cdPlayTrack == i) ? "\2 " : " ",
|
||||
i, tracks[i].is_audio ? "audio" : "data ",
|
||||
hms(tracks[i].len));
|
||||
if (tracks[i].is_audio)
|
||||
totaltime += tracks[i].len;
|
||||
}
|
||||
|
||||
if (totaltime)
|
||||
CONS_Printf ("\2Total time : %s\n", hms(totaltime));
|
||||
}
|
||||
if (cdPlaying)
|
||||
{
|
||||
CONS_Printf ("%s track : %d\n", cdLooping ? "looping" : "playing",
|
||||
cdPlayTrack);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strncmp(s,"play",4))
|
||||
{
|
||||
I_PlayCD ((UINT8)atoi (COM_Argv (2)), false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strncmp(s,"stop",4))
|
||||
{
|
||||
I_StopCD ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strncmp(s,"loop",4))
|
||||
{
|
||||
I_PlayCD ((UINT8)atoi (COM_Argv (2)), true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strncmp(s,"resume",4))
|
||||
{
|
||||
I_ResumeCD ();
|
||||
return;
|
||||
}
|
||||
|
||||
CONS_Printf ("cd command '%s' unknown\n", s);
|
||||
}
|
||||
|
||||
|
||||
// pause cd music
|
||||
void I_StopCD (void)
|
||||
{
|
||||
if (!cdaudio_started || !cdEnabled)
|
||||
return;
|
||||
|
||||
bcd_stop();
|
||||
|
||||
wasPlaying = cdPlaying;
|
||||
cdPlaying = false;
|
||||
}
|
||||
|
||||
// continue after a pause
|
||||
void I_ResumeCD (void)
|
||||
{
|
||||
if (!cdaudio_started || !cdEnabled)
|
||||
return;
|
||||
|
||||
if (!cdValid)
|
||||
return;
|
||||
|
||||
if (!wasPlaying)
|
||||
return;
|
||||
|
||||
bcd_resume ();
|
||||
cdPlaying = true;
|
||||
}
|
||||
|
||||
|
||||
void I_ShutdownCD (void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (!cdaudio_started)
|
||||
return;
|
||||
|
||||
I_StopCD ();
|
||||
|
||||
rc = bcd_close ();
|
||||
if (!rc)
|
||||
CONS_Printf ("Error shuting down cd\n");
|
||||
}
|
||||
|
||||
void I_InitCD (void)
|
||||
{
|
||||
int rc;
|
||||
int i;
|
||||
|
||||
rc = bcd_open ();
|
||||
|
||||
if (rc>=0x200)
|
||||
{
|
||||
CONS_Printf ("MSCDEX version %d.%d\n", rc>>8, rc&255);
|
||||
|
||||
I_AddExitFunc (I_ShutdownCD);
|
||||
cdaudio_started = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!rc)
|
||||
CONS_Printf ("%s\n", bcd_error() );
|
||||
|
||||
cdaudio_started = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// last saved in config.cfg
|
||||
i = cd_volume.value;
|
||||
I_SetVolumeCD (0); // initialize to 0 for some odd cd drivers
|
||||
I_SetVolumeCD (i); // now set the last saved volume
|
||||
|
||||
for (i = 0; i < MAX_CD_TRACKS; i++)
|
||||
cdRemap[i] = i;
|
||||
|
||||
if (!bcd_get_audio_info())
|
||||
{
|
||||
CONS_Printf("\2CD Init: No CD in player.\n");
|
||||
cdEnabled = false;
|
||||
cdValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
cdEnabled = true;
|
||||
cdValid = true;
|
||||
}
|
||||
|
||||
COM_AddCommand ("cd", Command_Cd_f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// loop/go to next track when track is finished (if cd_update var is true)
|
||||
// update the volume when it has changed (from console/menu)
|
||||
/// \todo check for cd change and restart music ?
|
||||
|
||||
void I_UpdateCD (void)
|
||||
{
|
||||
int newVolume;
|
||||
int now;
|
||||
static int last; //game tics (35th of second)
|
||||
|
||||
if (!cdaudio_started)
|
||||
return;
|
||||
|
||||
now = I_GetTime ();
|
||||
if ((now - last) < 10) // about 1/4 second
|
||||
return;
|
||||
last = now;
|
||||
|
||||
// update cd volume changed at console/menu
|
||||
newVolume = cd_volume.value & 31;
|
||||
|
||||
if (cdVolume != newVolume)
|
||||
I_SetVolumeCD (newVolume);
|
||||
|
||||
// slow drivers exit here
|
||||
if (!cdUpdate.value)
|
||||
return;
|
||||
|
||||
if (cdPlaying)
|
||||
{
|
||||
if (!bcd_audio_busy())
|
||||
{
|
||||
cdPlaying = false;
|
||||
if (cdLooping)
|
||||
I_PlayCD (cdPlayTrack, true);
|
||||
else
|
||||
{
|
||||
// play the next cd track, or restart the first
|
||||
cdPlayTrack++;
|
||||
if (cdPlayTrack > highest_track)
|
||||
cdPlayTrack = lowest_track;
|
||||
while (!tracks[cdPlayTrack].is_audio && cdPlayTrack<highest_track)
|
||||
cdPlayTrack++;
|
||||
I_PlayCD (cdPlayTrack, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
void I_PlayCD (UINT8 track, UINT8 looping)
|
||||
{
|
||||
if (!cdaudio_started || !cdEnabled)
|
||||
return;
|
||||
|
||||
if (!cdValid)
|
||||
return;
|
||||
|
||||
track = cdRemap[track];
|
||||
|
||||
if (cdPlaying)
|
||||
{
|
||||
if (cdPlayTrack == track)
|
||||
return;
|
||||
I_StopCD ();
|
||||
}
|
||||
|
||||
if (track < lowest_track || track > highest_track)
|
||||
{
|
||||
//CONS_Printf ("\2CD Audio: wrong track number %d\n", track);
|
||||
// suppose there are not enough tracks for game levels..
|
||||
// then do a modulo so we always get something to hear
|
||||
track = (track % (highest_track-lowest_track+1)) + 1;
|
||||
//return;
|
||||
}
|
||||
|
||||
cdPlayTrack = track;
|
||||
|
||||
if (!tracks[track].is_audio)
|
||||
{
|
||||
CONS_Printf ("\2CD Play: not an audio track\n");
|
||||
return;
|
||||
}
|
||||
|
||||
cdLooping = looping;
|
||||
|
||||
if (!bcd_play_track (track))
|
||||
{
|
||||
CONS_Printf ("CD Play: could not play track %d\n", track);
|
||||
cdValid = false;
|
||||
cdPlaying = false;
|
||||
return;
|
||||
}
|
||||
|
||||
cdPlaying = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// volume : logical cd audio volume 0-31 (hardware is 0-255)
|
||||
boolean I_SetVolumeCD (INT32 volume)
|
||||
{
|
||||
int hardvol;
|
||||
|
||||
if (!cdaudio_started || !cdEnabled)
|
||||
return false;
|
||||
|
||||
// translate to hardware volume
|
||||
volume &= 31;
|
||||
|
||||
hardvol = ((volume+1)<<3)-1; //highest volume is 255
|
||||
if (hardvol<=8)
|
||||
hardvol=0; //lowest volume is ZERO
|
||||
|
||||
cdVolume = volume;
|
||||
|
||||
if (bcd_set_volume (hardvol))
|
||||
{
|
||||
CV_SetValue (&cd_volume, volume);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief Main program, simply calls D_SRB2Main high level loop.
|
||||
|
||||
#include "../doomdef.h"
|
||||
|
||||
#include "../m_argv.h"
|
||||
#include "../d_main.h"
|
||||
|
||||
#include "../i_system.h"
|
||||
|
||||
#ifdef REMOTE_DEBUGGING
|
||||
#include <i386-stub.h>
|
||||
#include "rdb.h"
|
||||
#endif
|
||||
|
||||
//### let's try with Allegro ###
|
||||
#define alleg_mouse_unused
|
||||
#define alleg_timer_unused
|
||||
#define ALLEGRO_NO_KEY_DEFINES
|
||||
#define alleg_keyboard_unused
|
||||
#define alleg_joystick_unused
|
||||
#define alleg_gfx_driver_unused
|
||||
#define alleg_palette_unused
|
||||
#define alleg_graphics_unused
|
||||
#define alleg_vidmem_unused
|
||||
#define alleg_flic_unused
|
||||
#define alleg_sound_unused
|
||||
#define alleg_file_unused
|
||||
#define alleg_datafile_unused
|
||||
#define alleg_math_unused
|
||||
#define alleg_gui_unused
|
||||
#include <allegro.h>
|
||||
//### end of Allegro include ###
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
myargc = argc;
|
||||
myargv = argv;
|
||||
|
||||
{
|
||||
//added:03-01-98:
|
||||
// Setup signal handlers and other stuff BEFORE ANYTHING ELSE!
|
||||
I_StartupSystem();
|
||||
#ifdef REMOTE_DEBUGGING
|
||||
/* Only setup if remote debugging is to be done, Muhahahaha!*/
|
||||
gdb_serial_init(DEBUG_COM_PORT,DEBUG_COM_PORT_SPEED);
|
||||
gdb_target_init();
|
||||
breakpoint();
|
||||
#endif
|
||||
|
||||
D_SRB2Main();
|
||||
D_SRB2Loop();
|
||||
|
||||
}
|
||||
//added:03-01-98:
|
||||
// hmmm... it will never go here.
|
||||
|
||||
return 0;
|
||||
}
|
||||
#if ALLEGRO_VERSION == 4
|
||||
END_OF_MAIN()
|
||||
#endif
|
||||
@@ -1,113 +0,0 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief doomcom network interface
|
||||
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <go32.h>
|
||||
#include <pc.h>
|
||||
#include <dpmi.h>
|
||||
#include <dos.h>
|
||||
#include <sys/nearptr.h>
|
||||
|
||||
#include "../doomdef.h"
|
||||
|
||||
#include "../i_system.h"
|
||||
#include "../d_event.h"
|
||||
#include "../d_net.h"
|
||||
#include "../m_argv.h"
|
||||
|
||||
#include "../doomstat.h"
|
||||
#include "../z_zone.h"
|
||||
#include "../i_net.h"
|
||||
#include "../i_tcp.h"
|
||||
|
||||
//
|
||||
// NETWORKING
|
||||
//
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CMD_SEND = 1,
|
||||
CMD_GET = 2,
|
||||
} command_t;
|
||||
|
||||
static void External_Driver_Get(void);
|
||||
static void External_Driver_Send(void);
|
||||
static void External_Driver_FreeNode(INT32 nodenum);
|
||||
|
||||
static inline boolean External_Driver_OpenSocket(void)
|
||||
{
|
||||
I_NetGet = External_Driver_Get;
|
||||
I_NetSend = External_Driver_Send;
|
||||
I_NetCloseSocket = NULL;
|
||||
I_NetFreeNodenum = External_Driver_FreeNode;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// I_InitNetwork
|
||||
//
|
||||
boolean I_InitNetwork (void)
|
||||
{
|
||||
int netgamepar;
|
||||
|
||||
netgamepar = M_CheckParm ("-net");
|
||||
if (!netgamepar)
|
||||
return false;
|
||||
|
||||
// externals drivers specific
|
||||
|
||||
__djgpp_nearptr_enable();
|
||||
|
||||
// set up for network
|
||||
doomcom=(doomcom_t *)(__djgpp_conventional_base+atoi(myargv[netgamepar+1]));
|
||||
CONS_Printf("I_DosNet : Using int 0x%x for communication\n",doomcom->intnum);
|
||||
|
||||
server = (doomcom->consoleplayer == 0);
|
||||
if (!server)
|
||||
COM_BufAddText("connect any\n");
|
||||
|
||||
// ipx + time + 4 (padding)
|
||||
packetheaderlength=30+4+4;
|
||||
|
||||
hardware_MAXPACKETLENGTH = 512;
|
||||
|
||||
I_NetOpenSocket = External_Driver_OpenSocket;
|
||||
return true;
|
||||
}
|
||||
|
||||
FUNCNORETURN static ATTRNORETURN void External_Driver_Get(void)
|
||||
{
|
||||
I_Error("External_Driver_Get not supported at this time");
|
||||
}
|
||||
|
||||
FUNCNORETURN static ATTRNORETURN void External_Driver_Send(void)
|
||||
{
|
||||
I_Error("External_Driver_Send not supported at this time");
|
||||
}
|
||||
|
||||
FUNCNORETURN static ATTRNORETURN void External_Driver_FreeNode(INT32 nodenum)
|
||||
{
|
||||
nodenum = 0;
|
||||
I_Error("External_Driver_FreeNode not supported at this time");
|
||||
}
|
||||
@@ -1,619 +0,0 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief interface level code for sound
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "../doomdef.h"
|
||||
#include "../doomstat.h"
|
||||
#include "../i_system.h"
|
||||
#include "../i_sound.h"
|
||||
#include "../z_zone.h"
|
||||
#include "../m_argv.h"
|
||||
#include "../m_misc.h"
|
||||
#include "../w_wad.h"
|
||||
#include "../s_sound.h"
|
||||
#include "../console.h"
|
||||
|
||||
//### let's try with Allegro ###
|
||||
#define alleg_mouse_unused
|
||||
#define alleg_timer_unused
|
||||
#define ALLEGRO_NO_KEY_DEFINES
|
||||
#define alleg_keyboard_unused
|
||||
#define alleg_joystick_unused
|
||||
#define alleg_gfx_driver_unused
|
||||
#define alleg_palette_unused
|
||||
#define alleg_graphics_unused
|
||||
#define alleg_vidmem_unused
|
||||
#define alleg_flic_unused
|
||||
//#define alleg_sound_unused we use it
|
||||
#define alleg_file_unused
|
||||
#define alleg_datafile_unused
|
||||
#define alleg_math_unused
|
||||
#define alleg_gui_unused
|
||||
#include <allegro.h>
|
||||
//### end of Allegro include ###
|
||||
|
||||
//allegro has 256 virtual voices
|
||||
// warning should by a power of 2
|
||||
#define VIRTUAL_VOICES 256
|
||||
#define VOICESSHIFT 8
|
||||
|
||||
// Needed for calling the actual sound output.
|
||||
#define SAMPLECOUNT 512
|
||||
|
||||
|
||||
|
||||
//
|
||||
// this function converts raw 11khz, 8-bit data to a SAMPLE* that allegro uses
|
||||
// it is need cuz allegro only loads samples from wavs and vocs
|
||||
//added:11-01-98: now reads the frequency from the rawdata header.
|
||||
// dsdata points a 4 UINT16 header:
|
||||
// +0 : value 3 what does it mean?
|
||||
// +2 : sample rate, either 11025 or 22050.
|
||||
// +4 : number of samples, each sample is a single byte since it's 8bit
|
||||
// +6 : value 0
|
||||
static inline SAMPLE *raw2SAMPLE(UINT8 *dsdata, size_t len)
|
||||
{
|
||||
SAMPLE *spl;
|
||||
|
||||
spl=Z_Malloc(sizeof (SAMPLE),PU_SOUND,NULL);
|
||||
if (spl==NULL)
|
||||
I_Error("Raw2Sample : no more free mem");
|
||||
spl->bits = 8;
|
||||
spl->stereo = 0;
|
||||
spl->freq = *((UINT16 *)dsdata+1); //mostly 11025, but some at 22050.
|
||||
spl->len = len-8;
|
||||
spl->priority = 255; //priority;
|
||||
spl->loop_start = 0;
|
||||
spl->loop_end = len-8;
|
||||
spl->param = -1;
|
||||
spl->data=(void *)(dsdata+8); //skip the 8bytes header
|
||||
|
||||
return spl;
|
||||
}
|
||||
|
||||
|
||||
// This function loads the sound data from the WAD lump,
|
||||
// for single sound.
|
||||
//
|
||||
void *I_GetSfx (sfxinfo_t * sfx)
|
||||
{
|
||||
UINT8 *dssfx;
|
||||
|
||||
if (sfx->lumpnum == LUMPERROR)
|
||||
sfx->lumpnum = S_GetSfxLumpNum (sfx);
|
||||
|
||||
sfx->length = W_LumpLength (sfx->lumpnum);
|
||||
|
||||
dssfx = (UINT8 *) W_CacheLumpNum (sfx->lumpnum, PU_SOUND);
|
||||
//_go32_dpmi_lock_data(dssfx,size);
|
||||
|
||||
// convert raw data and header from Doom sfx to a SAMPLE for Allegro
|
||||
return (void *)raw2SAMPLE (dssfx, sfx->length);
|
||||
}
|
||||
|
||||
|
||||
void I_FreeSfx (sfxinfo_t *sfx)
|
||||
{
|
||||
if (sfx->lumpnum == LUMPERROR)
|
||||
return;
|
||||
|
||||
// free sample data
|
||||
if ( sfx->data )
|
||||
Z_Free((UINT8 *) ((SAMPLE *)sfx->data)->data - 8);
|
||||
Z_Free(sfx->data); // Allegro SAMPLE structure
|
||||
sfx->data = NULL;
|
||||
sfx->lumpnum = LUMPERROR;
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE int Volset(int vol)
|
||||
{
|
||||
return (vol*255/31);
|
||||
}
|
||||
|
||||
|
||||
void I_SetSfxVolume(INT32 volume)
|
||||
{
|
||||
if (sound_disabled)
|
||||
return;
|
||||
|
||||
set_volume (Volset(volume),-1);
|
||||
}
|
||||
|
||||
//
|
||||
// Starting a sound means adding it
|
||||
// to the current list of active sounds
|
||||
// in the internal channels.
|
||||
// As the SFX info struct contains
|
||||
// e.g. a pointer to the raw data,
|
||||
// it is ignored.
|
||||
// As our sound handling does not handle
|
||||
// priority, it is ignored.
|
||||
// Pitching (that is, increased speed of playback)
|
||||
// is set, but currently not used by mixing.
|
||||
//
|
||||
INT32 I_StartSound ( sfxenum_t id,
|
||||
INT32 vol,
|
||||
INT32 sep,
|
||||
INT32 pitch,
|
||||
INT32 priority,
|
||||
INT32 channel)
|
||||
{
|
||||
int voice;
|
||||
(void)channel;
|
||||
|
||||
if (sound_disabled)
|
||||
return 0;
|
||||
|
||||
// UNUSED
|
||||
priority = 0;
|
||||
|
||||
pitch = (pitch-128)/2+128;
|
||||
voice = play_sample(S_sfx[id].data,vol,sep,(pitch*1000)/128,0);
|
||||
|
||||
// Returns a handle
|
||||
return (id<<VOICESSHIFT)+voice;
|
||||
}
|
||||
|
||||
void I_StopSound (INT32 handle)
|
||||
{
|
||||
// You need the handle returned by StartSound.
|
||||
// Would be looping all channels,
|
||||
// tracking down the handle,
|
||||
// an setting the channel to zero.
|
||||
int voice=handle & (VIRTUAL_VOICES-1);
|
||||
|
||||
if (sound_disabled)
|
||||
return;
|
||||
|
||||
if (voice_check(voice)==S_sfx[handle>>VOICESSHIFT].data)
|
||||
deallocate_voice(voice);
|
||||
}
|
||||
|
||||
INT32 I_SoundIsPlaying(INT32 handle)
|
||||
{
|
||||
if (sound_disabled)
|
||||
return FALSE;
|
||||
|
||||
if (voice_check(handle & (VIRTUAL_VOICES-1))==S_sfx[handle>>VOICESSHIFT].data)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// cut and past from ALLEGRO he don't share it :(
|
||||
static inline int absolute_freq(int freq, SAMPLE *spl)
|
||||
{
|
||||
if (freq == 1000)
|
||||
return spl->freq;
|
||||
else
|
||||
return (spl->freq * freq) / 1000;
|
||||
}
|
||||
|
||||
void I_UpdateSoundParams( INT32 handle,
|
||||
INT32 vol,
|
||||
INT32 sep,
|
||||
INT32 pitch)
|
||||
{
|
||||
// I fail too see that this is used.
|
||||
// Would be using the handle to identify
|
||||
// on which channel the sound might be active,
|
||||
// and resetting the channel parameters.
|
||||
int voice=handle & (VIRTUAL_VOICES-1);
|
||||
int numsfx=handle>>VOICESSHIFT;
|
||||
|
||||
if (sound_disabled)
|
||||
return;
|
||||
|
||||
if (voice_check(voice)==S_sfx[numsfx].data)
|
||||
{
|
||||
voice_set_volume(voice, vol);
|
||||
voice_set_pan(voice, sep);
|
||||
voice_set_frequency(voice, absolute_freq(pitch*1000/128,
|
||||
S_sfx[numsfx].data));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void I_ShutdownSound(void)
|
||||
{
|
||||
// Wait till all pending sounds are finished.
|
||||
|
||||
//added:03-01-98:
|
||||
if ( !sound_started )
|
||||
return;
|
||||
|
||||
//added:08-01-98: remove_sound() explicitly because we don't use
|
||||
// Allegro's allegro_exit();
|
||||
remove_sound();
|
||||
sound_started = false;
|
||||
}
|
||||
|
||||
static char soundheader[] = "sound";
|
||||
#if ALLEGRO_VERSION == 3
|
||||
static char soundvar[] = "sb_freq";
|
||||
#else
|
||||
static char soundvar[] = "sound_freq";
|
||||
#endif
|
||||
|
||||
void I_StartupSound(void)
|
||||
{
|
||||
int sfxcard,midicard;
|
||||
#if ALLEGRO_VERSION == 3
|
||||
char err[255];
|
||||
#endif
|
||||
|
||||
if (sound_disabled)
|
||||
sfxcard=DIGI_NONE;
|
||||
else
|
||||
sfxcard=DIGI_AUTODETECT;
|
||||
|
||||
if (midi_disabled)
|
||||
midicard=MIDI_NONE;
|
||||
else
|
||||
midicard=MIDI_AUTODETECT; //DetectMusicCard();
|
||||
|
||||
digital_disabled=true; //Alam: No OGG/MP3/IT/MOD support
|
||||
|
||||
// Secure and configure sound device first.
|
||||
CONS_Printf("I_StartupSound: ");
|
||||
|
||||
//Fab:25-04-98:note:install_sound will check for sound settings
|
||||
// in the sound.cfg or allegro.cfg, in the current directory,
|
||||
// or the directory pointed by 'ALLEGRO' env var.
|
||||
#if ALLEGRO_VERSION == 3
|
||||
if (install_sound(sfxcard,midicard,NULL)!=0)
|
||||
{
|
||||
sprintf (err,"Sound init error : %s\n",allegro_error);
|
||||
CONS_Error (err);
|
||||
sound_disabled=true;
|
||||
midi_disabled=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf(" configured audio device\n" );
|
||||
}
|
||||
|
||||
//added:08-01-98:we use a similar startup/shutdown scheme as Allegro.
|
||||
I_AddExitFunc(I_ShutdownSound);
|
||||
#endif
|
||||
sound_started = true;
|
||||
CV_SetValue(&cv_samplerate,get_config_int(soundheader,soundvar,cv_samplerate.value));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// MUSIC API.
|
||||
// Still no music done.
|
||||
// Remains. Dummies.
|
||||
//
|
||||
|
||||
static MIDI* currsong; //im assuming only 1 song will be played at once
|
||||
static int islooping=0;
|
||||
static int musicdies=-1;
|
||||
UINT8 music_started=0;
|
||||
boolean songpaused=false;
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC SYSTEM
|
||||
/// ------------------------
|
||||
|
||||
/* load_midi_mem:
|
||||
* Loads a standard MIDI file from memory, returning a pointer to
|
||||
* a MIDI structure, * or NULL on error.
|
||||
* It is the load_midi from Allegro modified to load it from memory
|
||||
*/
|
||||
static MIDI *load_midi_mem(char *mempointer,int *e)
|
||||
{
|
||||
int c = *e;
|
||||
long data=0;
|
||||
unsigned char *fp;
|
||||
MIDI *midi;
|
||||
int num_tracks=0;
|
||||
|
||||
fp = (void *)mempointer;
|
||||
if (!fp)
|
||||
return NULL;
|
||||
|
||||
midi = malloc(sizeof (MIDI)); /* get some memory */
|
||||
if (!midi)
|
||||
return NULL;
|
||||
|
||||
for (c=0; c<MIDI_TRACKS; c++)
|
||||
{
|
||||
midi->track[c].data = NULL;
|
||||
midi->track[c].len = 0;
|
||||
}
|
||||
|
||||
fp+=4+4; // header size + 'chunk' size
|
||||
|
||||
swab(fp,&data,2); // convert to intel-endian
|
||||
fp+=2; /* MIDI file type */
|
||||
if ((data != 0) && (data != 1)) // only type 0 and 1 are suported
|
||||
return NULL;
|
||||
|
||||
swab(fp,&num_tracks,2); /* number of tracks */
|
||||
fp+=2;
|
||||
if ((num_tracks < 1) || (num_tracks > MIDI_TRACKS))
|
||||
return NULL;
|
||||
|
||||
swab(fp,&data,2); /* beat divisions */
|
||||
fp+=2;
|
||||
midi->divisions = ABS(data);
|
||||
|
||||
for (c=0; c<num_tracks; c++)
|
||||
{ /* read each track */
|
||||
if (memcmp(fp, "MTrk", 4))
|
||||
return NULL;
|
||||
fp+=4;
|
||||
|
||||
//swab(fp,&data,4); don't work !!!!??
|
||||
((char *)&data)[0]=fp[3];
|
||||
((char *)&data)[1]=fp[2];
|
||||
((char *)&data)[2]=fp[1];
|
||||
((char *)&data)[3]=fp[0];
|
||||
fp+=4;
|
||||
|
||||
midi->track[c].len = data;
|
||||
|
||||
midi->track[c].data = fp;
|
||||
fp+=data;
|
||||
}
|
||||
|
||||
lock_midi(midi);
|
||||
return midi;
|
||||
}
|
||||
|
||||
void I_InitMusic(void)
|
||||
{
|
||||
if (midi_disabled)
|
||||
return;
|
||||
|
||||
I_AddExitFunc(I_ShutdownMusic);
|
||||
music_started = true;
|
||||
songpaused = false;
|
||||
}
|
||||
|
||||
void I_ShutdownMusic(void)
|
||||
{
|
||||
if ( !music_started )
|
||||
return;
|
||||
|
||||
I_StopSong();
|
||||
|
||||
music_started=false;
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC PROPERTIES
|
||||
/// ------------------------
|
||||
|
||||
musictype_t I_SongType(void)
|
||||
{
|
||||
if (currsong)
|
||||
return MU_MID;
|
||||
else
|
||||
return MU_NONE;
|
||||
}
|
||||
|
||||
boolean I_SongPlaying()
|
||||
{
|
||||
return (boolean)currsong;
|
||||
}
|
||||
|
||||
boolean I_SongPaused()
|
||||
{
|
||||
return songpaused;
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC EFFECTS
|
||||
/// ------------------------
|
||||
|
||||
boolean I_SetSongSpeed(float speed)
|
||||
{
|
||||
(void)speed;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC SEEKING
|
||||
/// ------------------------
|
||||
|
||||
UINT32 I_GetSongLength(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean I_SetSongLoopPoint(UINT32 looppoint)
|
||||
{
|
||||
(void)looppoint;
|
||||
return false;
|
||||
}
|
||||
|
||||
UINT32 I_GetSongLoopPoint(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean I_SetSongPosition(UINT32 position)
|
||||
{
|
||||
(void)position;
|
||||
return false;
|
||||
}
|
||||
|
||||
UINT32 I_GetSongPosition(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC PLAYBACK
|
||||
/// ------------------------
|
||||
|
||||
boolean I_LoadSong(char *data, size_t len)
|
||||
{
|
||||
int e = len; //Alam: For error
|
||||
if (midi_disabled)
|
||||
return 0;
|
||||
|
||||
if (memcmp(data,"MThd",4)==0) // support mid file in WAD !!!
|
||||
{
|
||||
currsong=load_midi_mem(data,&e);
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf("Music Lump is not a MIDI lump\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (currsong==NULL)
|
||||
{
|
||||
CONS_Printf("Not a valid mid file : %d\n",e);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void I_UnloadSong(void)
|
||||
{
|
||||
handle = 0;
|
||||
if (midi_disabled)
|
||||
return;
|
||||
|
||||
//destroy_midi(currsong);
|
||||
}
|
||||
|
||||
boolean I_PlaySong(boolean looping)
|
||||
{
|
||||
handle = 0;
|
||||
if (midi_disabled)
|
||||
return false;
|
||||
|
||||
islooping = looping;
|
||||
musicdies = gametic + NEWTICRATE*30;
|
||||
if (play_midi(currsong,looping)==0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void I_StopSong(void)
|
||||
{
|
||||
handle = 0;
|
||||
if (midi_disabled)
|
||||
return;
|
||||
|
||||
islooping = 0;
|
||||
musicdies = 0;
|
||||
stop_midi();
|
||||
songpaused = false;
|
||||
}
|
||||
|
||||
void I_PauseSong (INT32 handle)
|
||||
{
|
||||
handle = 0;
|
||||
if (midi_disabled)
|
||||
return;
|
||||
midi_pause();
|
||||
songpaused = true;
|
||||
}
|
||||
|
||||
void I_ResumeSong (INT32 handle)
|
||||
{
|
||||
handle = 0;
|
||||
if (midi_disabled)
|
||||
return;
|
||||
midi_resume();
|
||||
songpaused = false;
|
||||
}
|
||||
|
||||
void I_SetMusicVolume(INT32 volume)
|
||||
{
|
||||
if (midi_disabled)
|
||||
return;
|
||||
|
||||
// Now set volume on output device.
|
||||
set_volume (-1, Volset(volume));
|
||||
}
|
||||
|
||||
boolean I_SetSongTrack(INT32 track)
|
||||
{
|
||||
(void)track;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Is the song playing?
|
||||
#if 0
|
||||
int I_QrySongPlaying(int handle)
|
||||
{
|
||||
if (midi_disabled)
|
||||
return 0;
|
||||
|
||||
//return islooping || musicdies > gametic;
|
||||
return (midi_pos==-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// ------------------------
|
||||
// MUSIC FADING
|
||||
/// ------------------------
|
||||
|
||||
void I_SetInternalMusicVolume(UINT8 volume)
|
||||
{
|
||||
(void)volume;
|
||||
}
|
||||
|
||||
void I_StopFadingSong(void)
|
||||
{
|
||||
}
|
||||
|
||||
boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms, void (*callback)(void));
|
||||
{
|
||||
(void)target_volume;
|
||||
(void)source_volume;
|
||||
(void)ms;
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void));
|
||||
{
|
||||
(void)target_volume;
|
||||
(void)ms;
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean I_FadeOutStopSong(UINT32 ms)
|
||||
{
|
||||
(void)ms;
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean I_FadeInPlaySong(UINT32 ms, boolean looping)
|
||||
{
|
||||
(void)ms;
|
||||
(void)looping;
|
||||
return false;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,336 +0,0 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief hardware and software level, screen and video i/o, refresh,
|
||||
/// setup ... a big mess. Got to clean that up!
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
//#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
//#include <errnos.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <go32.h>
|
||||
#include <pc.h>
|
||||
#include <dpmi.h>
|
||||
#include <dos.h>
|
||||
#include <sys/nearptr.h>
|
||||
|
||||
#include "../doomdef.h"
|
||||
#include "../i_system.h"
|
||||
#include "../v_video.h"
|
||||
#include "../m_argv.h"
|
||||
#include "vid_vesa.h"
|
||||
#include "../i_video.h"
|
||||
|
||||
|
||||
//dosstuff -newly added
|
||||
static unsigned long dascreen;
|
||||
static int gfx_use_vesa1;
|
||||
|
||||
boolean highcolor;
|
||||
|
||||
#define SCREENDEPTH 1 // bytes per pixel, do NOT change.
|
||||
|
||||
rendermode_t rendermode=render_soft;
|
||||
|
||||
//
|
||||
// I_OsPolling
|
||||
//
|
||||
void I_OsPolling(void)
|
||||
{
|
||||
I_GetEvent();
|
||||
//i dont think i have to do anything else here
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// I_UpdateNoBlit
|
||||
//
|
||||
void I_UpdateNoBlit (void)
|
||||
{
|
||||
// what is this?
|
||||
}
|
||||
|
||||
|
||||
//profile stuff ---------------------------------------------------------
|
||||
//added:16-01-98:wanted to profile the VID_BlitLinearScreen() asm code.
|
||||
//#define TIMING //uncomment this to enable profiling
|
||||
#ifdef TIMING
|
||||
#include "../p5prof.h"
|
||||
static INT64 mycount;
|
||||
static INT64 mytotal = 0;
|
||||
static unsigned long nombre = NEWTICRATE*10;
|
||||
//static char runtest[10][80];
|
||||
#endif
|
||||
//profile stuff ---------------------------------------------------------
|
||||
|
||||
//
|
||||
// I_FinishUpdate
|
||||
//
|
||||
static void I_BlitScreenVesa1(void); //see later
|
||||
void I_FinishUpdate (void)
|
||||
{
|
||||
// draw FPS if enabled
|
||||
if (cv_ticrate.value)
|
||||
SCR_DisplayTicRate();
|
||||
|
||||
if (cv_showping.value && netgame && consoleplayer != serverplayer)
|
||||
SCR_DisplayLocalPing();
|
||||
|
||||
//blast it to the screen
|
||||
// this code sucks
|
||||
//memcpy(dascreen,screens[0],screenwidth*screenheight);
|
||||
|
||||
//added:03-01-98: I tried to I_WaitVBL(1) here, but it slows down
|
||||
// the game when the view becomes complicated, it looses ticks
|
||||
if (cv_vidwait.value)
|
||||
I_WaitVBL(1);
|
||||
|
||||
|
||||
//added:16-01-98:profile screen blit.
|
||||
#ifdef TIMING
|
||||
ProfZeroTimer();
|
||||
#endif
|
||||
//added:08-01-98: support vesa1 bank change, without Allegro's BITMAP screen.
|
||||
if ( gfx_use_vesa1 )
|
||||
{
|
||||
I_Error("Banked screen update not finished for dynamic res\n");
|
||||
I_BlitScreenVesa1(); //blast virtual to physical screen.
|
||||
}
|
||||
else
|
||||
{
|
||||
//added:16-01-98:use quickie asm routine, last 2 args are
|
||||
// src and dest rowbytes
|
||||
// (memcpy is as fast as this one...)
|
||||
VID_BlitLinearScreen(screens[0], vid.direct,
|
||||
vid.width*vid.bpp, vid.height,
|
||||
vid.width*vid.bpp, vid.rowbytes );
|
||||
}
|
||||
#ifdef TIMING
|
||||
RDMSR(0x10,&mycount);
|
||||
mytotal += mycount; //64bit add
|
||||
|
||||
if (nombre--==0)
|
||||
I_Error("ScreenBlit CPU Spy reports: 0x%d %d\n", *((int *)&mytotal+1),
|
||||
(int)mytotal );
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// I_UpdateNoVsync
|
||||
//
|
||||
void I_UpdateNoVsync(void)
|
||||
{
|
||||
int real_vidwait = cv_vidwait.value;
|
||||
cv_vidwait.value = 0;
|
||||
I_FinishUpdate();
|
||||
cv_vidwait.value = real_vidwait;
|
||||
}
|
||||
|
||||
//
|
||||
// I_ReadScreen
|
||||
//
|
||||
void I_ReadScreen (UINT8 *scr)
|
||||
{
|
||||
VID_BlitLinearScreen(screens[0], scr,
|
||||
vid.width*vid.bpp, vid.height,
|
||||
vid.width*vid.bpp, vid.rowbytes );
|
||||
}
|
||||
|
||||
|
||||
void I_SetPalette (RGBA_t *palette)
|
||||
{
|
||||
int i;
|
||||
|
||||
outportb(0x3c8,0);
|
||||
for (i=0;i<256;i++,palette++)
|
||||
{
|
||||
outportb(0x3c9,palette->s.red>>2);
|
||||
outportb(0x3c9,palette->s.green>>2);
|
||||
outportb(0x3c9,palette->s.blue>>2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//added 29-12-1997
|
||||
/*==========================================================================*/
|
||||
// I_BlastScreen : copy the virtual screen buffer to the physical screen mem
|
||||
// using bank switching if needed.
|
||||
/*==========================================================================*/
|
||||
static void I_BlitScreenVesa1(void)
|
||||
{
|
||||
#define VIDBANKSIZE (1<<16)
|
||||
#define VIDBANKSIZEMASK (VIDBANKSIZE-1) // defines ahoy!
|
||||
|
||||
__dpmi_regs r;
|
||||
UINT8 *p_src;
|
||||
long i;
|
||||
long virtualsize;
|
||||
|
||||
// virtual screen buffer size
|
||||
virtualsize = vid.rowbytes * vid.height * SCREENDEPTH;
|
||||
|
||||
p_src = screens[0];
|
||||
|
||||
for (i=0; virtualsize > 0; i++ )
|
||||
{
|
||||
r.x.ax = 0x4f05;
|
||||
r.x.bx = 0x0;
|
||||
r.x.cx = 0x0;
|
||||
r.x.dx = i;
|
||||
__dpmi_int(0x10,&r); //set bank
|
||||
|
||||
M_Memcpy((UINT8 *)dascreen,p_src,(virtualsize < VIDBANKSIZE) ? virtualsize : VIDBANKSIZE );
|
||||
|
||||
p_src += VIDBANKSIZE;
|
||||
virtualsize -= VIDBANKSIZE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//added:08-01-98: now we use Allegro's set_gfx_mode, but we want to
|
||||
// restore the exact text mode that was before.
|
||||
static INT16 myOldVideoMode;
|
||||
static inline void I_SaveOldVideoMode(void)
|
||||
{
|
||||
__dpmi_regs r;
|
||||
r.x.ax = 0x4f03; // Return current video mode
|
||||
__dpmi_int(0x10,&r);
|
||||
if ( r.x.ax != 0x4f )
|
||||
myOldVideoMode = -1;
|
||||
else
|
||||
myOldVideoMode = r.x.bx;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Close the screen, restore previous video mode.
|
||||
//
|
||||
void I_ShutdownGraphics (void)
|
||||
{
|
||||
__dpmi_regs r;
|
||||
|
||||
rendermode = render_none;
|
||||
if ( !graphics_started )
|
||||
return;
|
||||
|
||||
// free the last video mode screen buffers
|
||||
if (vid.buffer)
|
||||
free (vid.buffer);
|
||||
|
||||
/* Restore old video mode */
|
||||
if (myOldVideoMode!=-1)
|
||||
{
|
||||
/* Restore old video mode */
|
||||
r.x.ax = 0x4f02; // Set Super VGA video mode
|
||||
r.x.bx = myOldVideoMode;
|
||||
__dpmi_int(0x10,&r);
|
||||
|
||||
// Boris: my s3 don't do a cls because "win95" :<
|
||||
clrscr();
|
||||
}
|
||||
else // no vesa put the normal video mode
|
||||
{
|
||||
r.x.ax = 0x03;
|
||||
__dpmi_int(0x10,&r);
|
||||
}
|
||||
|
||||
graphics_started = false;
|
||||
}
|
||||
|
||||
|
||||
//added:08-01-98:
|
||||
// Set VESA1 video mode, coz Allegro set_gfx_mode a larger screenwidth...
|
||||
//
|
||||
#if 0
|
||||
int set_vesa1_mode( int width, int height )
|
||||
{
|
||||
__dpmi_regs r;
|
||||
|
||||
// setup video mode.
|
||||
r.x.ax = 0x4f02;
|
||||
if ( ( width==320 )&&( height==200 ) && ( SCREENDEPTH==1 ) )
|
||||
r.x.bx = 0x13; // 320x 200x1 (256 colors)
|
||||
else
|
||||
if ( ( width==320 )&&( height==240 ) && ( SCREENDEPTH==1 ) )
|
||||
r.x.bx = 0x154; // 320x 240x1 (256 colors)
|
||||
else
|
||||
if ( ( width==320 )&&( height==400 ) && ( SCREENDEPTH==1 ) )
|
||||
r.x.bx = 0x155; // 320x 400x1 (256 colors)
|
||||
else
|
||||
if ( ( width==640 )&&( height==400 ) && ( SCREENDEPTH==1 ) )
|
||||
r.x.bx = 0x100; // 640x 400x1 (256 colors)
|
||||
else
|
||||
if ( ( width==640 )&&( height==480 ) && ( SCREENDEPTH==1 ) )
|
||||
r.x.bx = 0x101; // 640x 480x1 (256 colors)
|
||||
else
|
||||
if ( ( width==800 )&&( height==600 ) && ( SCREENDEPTH==1 ) )
|
||||
r.x.bx = 0x103; // 800x 600x1 (256 colors)
|
||||
else
|
||||
if ( ( width==1024)&&( height==768 ) && ( SCREENDEPTH==1 ) )
|
||||
r.x.bx = 0x105; //1024x 768x1 (256 colors)
|
||||
else
|
||||
I_Error("I_SetVesa1Mode: video mode not supported.");
|
||||
|
||||
// enter graphics mode.
|
||||
__dpmi_int(0x10,&r);
|
||||
|
||||
if ( r.x.ax != 0x4f )
|
||||
I_Error("I_SetVesa1Mode: init video mode failed !");
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//added:08-01-98: now uses Allegro to setup Linear Frame Buffer video modes.
|
||||
//
|
||||
// Initialize video mode, setup dynamic screen size variables,
|
||||
// and allocate screens.
|
||||
//
|
||||
void I_StartupGraphics(void)
|
||||
{
|
||||
//added:26-01-98: VID_Init() must be done only once,
|
||||
// use VID_SetMode() to change vid mode while in the game.
|
||||
if ( graphics_started )
|
||||
return;
|
||||
|
||||
// remember the exact screen mode we were...
|
||||
I_SaveOldVideoMode();
|
||||
|
||||
CONS_Printf("Vid_Init...");
|
||||
|
||||
// 0 for 256 color, else use highcolor modes
|
||||
highcolor = M_CheckParm ("-highcolor");
|
||||
|
||||
VID_Init();
|
||||
|
||||
//gfx_use_vesa1 = false;
|
||||
|
||||
//added:03-01-98: register exit code for graphics
|
||||
I_AddExitFunc(I_ShutdownGraphics);
|
||||
graphics_started = true;
|
||||
|
||||
}
|
||||
@@ -1,773 +0,0 @@
|
||||
/* ______ ___ ___
|
||||
* /\ _ \ /\_ \ /\_ \
|
||||
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
|
||||
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
|
||||
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
|
||||
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
|
||||
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
|
||||
* /\____/
|
||||
* \_/__/
|
||||
*
|
||||
* Some definitions for internal use by the library code.
|
||||
* This should not be included by user programs.
|
||||
*
|
||||
* By Shawn Hargreaves.
|
||||
*
|
||||
* See readme.txt for copyright information.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INTERNAL_H
|
||||
#define INTERNAL_H
|
||||
|
||||
#include "allegro.h"
|
||||
|
||||
/* ______ ___ ___
|
||||
* /\ _ \ /\_ \ /\_ \
|
||||
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
|
||||
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
|
||||
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
|
||||
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
|
||||
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
|
||||
* /\____/
|
||||
* \_/__/
|
||||
*
|
||||
* Some definitions for internal use by the library code.
|
||||
* This should not be included by user programs.
|
||||
*
|
||||
* By Shawn Hargreaves.
|
||||
*
|
||||
* See readme.txt for copyright information.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INTERNDJ_H
|
||||
#define INTERNDJ_H
|
||||
|
||||
#ifndef DJGPP
|
||||
#error This file should only be used by the djgpp version of Allegro
|
||||
#endif
|
||||
|
||||
|
||||
#include <dos.h>
|
||||
|
||||
|
||||
/* file access macros */
|
||||
#define FILE_OPEN(filename, handle) handle = open(filename, O_RDONLY | O_BINARY, S_IRUSR | S_IWUSR)
|
||||
#define FILE_CREATE(filename, handle) handle = open(filename, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)
|
||||
#define FILE_CLOSE(handle) close(handle)
|
||||
#define FILE_READ(handle, buf, size, sz) sz = read(handle, buf, size)
|
||||
#define FILE_WRITE(handle, buf, size, sz) sz = write(handle, buf, size)
|
||||
#define FILE_SEARCH_STRUCT struct ffblk
|
||||
#define FILE_FINDFIRST(filename, attrib, dta) findfirst(filename, dta, attrib)
|
||||
#define FILE_FINDNEXT(dta) findnext(dta)
|
||||
#define FILE_ATTRIB ff_attrib
|
||||
#define FILE_SIZE ff_fsize
|
||||
#define FILE_NAME ff_name
|
||||
#define FILE_TIME ff_ftime
|
||||
#define FILE_DATE ff_fdate
|
||||
|
||||
|
||||
/* macros to enable and disable interrupts */
|
||||
#define DISABLE() asm volatile ("cli")
|
||||
#define ENABLE() asm volatile ("sti")
|
||||
|
||||
|
||||
__INLINE__ void enter_critical(void)
|
||||
{
|
||||
if (windows_version >= 3) {
|
||||
__dpmi_regs r;
|
||||
r.x.ax = 0x1681;
|
||||
__dpmi_int(0x2F, &r);
|
||||
}
|
||||
|
||||
DISABLE();
|
||||
}
|
||||
|
||||
|
||||
__INLINE__ void exit_critical(void)
|
||||
{
|
||||
if (windows_version >= 3) {
|
||||
__dpmi_regs r;
|
||||
r.x.ax = 0x1682;
|
||||
__dpmi_int(0x2F, &r);
|
||||
}
|
||||
|
||||
ENABLE();
|
||||
}
|
||||
|
||||
|
||||
/* interrupt hander stuff */
|
||||
#define _map_irq(irq) (((irq)>7) ? ((irq)+104) : ((irq)+8))
|
||||
|
||||
int _install_irq(int num, int (*handler)(void));
|
||||
void _remove_irq(int num);
|
||||
void _restore_irq(int irq);
|
||||
void _enable_irq(int irq);
|
||||
void _disable_irq(int irq);
|
||||
|
||||
#define _eoi(irq) { outportb(0x20, 0x20); if ((irq)>7) outportb(0xA0, 0x20); }
|
||||
|
||||
typedef struct _IRQ_HANDLER
|
||||
{
|
||||
int (*handler)(void); /* our C handler */
|
||||
int number; /* irq number */
|
||||
__dpmi_paddr old_vector; /* original protected mode vector */
|
||||
} _IRQ_HANDLER;
|
||||
|
||||
|
||||
/* DPMI memory mapping routines */
|
||||
int _create_physical_mapping(unsigned long *linear, int *segment, unsigned long physaddr, int size);
|
||||
void _remove_physical_mapping(unsigned long *linear, int *segment);
|
||||
int _create_linear_mapping(unsigned long *linear, unsigned long physaddr, int size);
|
||||
void _remove_linear_mapping(unsigned long *linear);
|
||||
int _create_selector(int *segment, unsigned long linear, int size);
|
||||
void _remove_selector(int *segment);
|
||||
void _unlock_dpmi_data(void *addr, int size);
|
||||
|
||||
|
||||
/* bank switching routines */
|
||||
void _accel_bank_stub(void);
|
||||
void _accel_bank_stub_end(void);
|
||||
|
||||
void _accel_bank_switch (void);
|
||||
void _accel_bank_switch_end(void);
|
||||
|
||||
void _vesa_window_1(void);
|
||||
void _vesa_window_1_end(void);
|
||||
void _vesa_window_2(void);
|
||||
void _vesa_window_2_end(void);
|
||||
|
||||
void _vesa_pm_window_1(void);
|
||||
void _vesa_pm_window_1_end(void);
|
||||
void _vesa_pm_window_2(void);
|
||||
void _vesa_pm_window_2_end(void);
|
||||
|
||||
void _vesa_pm_es_window_1(void);
|
||||
void _vesa_pm_es_window_1_end(void);
|
||||
void _vesa_pm_es_window_2(void);
|
||||
void _vesa_pm_es_window_2_end(void);
|
||||
|
||||
|
||||
/* stuff for the VESA and VBE/AF drivers */
|
||||
extern __dpmi_regs _dpmi_reg;
|
||||
|
||||
extern int _window_2_offset;
|
||||
|
||||
extern void (*_pm_vesa_switcher)(void);
|
||||
extern void (*_pm_vesa_scroller)(void);
|
||||
extern void (*_pm_vesa_pallete)(void);
|
||||
|
||||
extern int _mmio_segment;
|
||||
|
||||
extern void *_accel_driver;
|
||||
|
||||
extern int _accel_active;
|
||||
|
||||
extern void *_accel_set_bank;
|
||||
extern void *_accel_idle;
|
||||
|
||||
void _fill_vbeaf_libc_exports(void *ptr);
|
||||
void _fill_vbeaf_pmode_exports(void *ptr);
|
||||
|
||||
|
||||
/* sound lib stuff */
|
||||
extern int _fm_port;
|
||||
extern int _mpu_port;
|
||||
extern int _mpu_irq;
|
||||
extern int _sb_freq;
|
||||
extern int _sb_port;
|
||||
extern int _sb_dma;
|
||||
extern int _sb_irq;
|
||||
|
||||
int _sb_read_dsp_version(void);
|
||||
int _sb_reset_dsp(int data);
|
||||
void _sb_voice(int state);
|
||||
int _sb_set_mixer(int digi_volume, int midi_volume);
|
||||
|
||||
void _mpu_poll(void);
|
||||
|
||||
int _dma_allocate_mem(int bytes, int *sel, unsigned long *phys);
|
||||
void _dma_start(int channel, unsigned long addr, int size, int auto_init, int input);
|
||||
void _dma_stop(int channel);
|
||||
unsigned long _dma_todo(int channel);
|
||||
void _dma_lock_mem(void);
|
||||
|
||||
|
||||
#endif /* ifndef INTERNDJ_H */
|
||||
|
||||
|
||||
/* flag for how many times we have been initialised */
|
||||
extern int _allegro_count;
|
||||
|
||||
|
||||
/* some Allegro functions need a block of scratch memory */
|
||||
extern void *_scratch_mem;
|
||||
extern int _scratch_mem_size;
|
||||
|
||||
__INLINE__ void _grow_scratch_mem(int size)
|
||||
{
|
||||
if (size > _scratch_mem_size) {
|
||||
size = (size+1023) & 0xFFFFFC00;
|
||||
_scratch_mem = realloc(_scratch_mem, size);
|
||||
_scratch_mem_size = size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* list of functions to call at program cleanup */
|
||||
void _add_exit_func(void (*func)(void));
|
||||
void _remove_exit_func(void (*func)(void));
|
||||
|
||||
|
||||
/* reads a translation file into memory */
|
||||
void _load_config_text(void);
|
||||
|
||||
|
||||
/* various bits of mouse stuff */
|
||||
void _set_mouse_range(void);
|
||||
extern BITMAP *_mouse_screen;
|
||||
extern BITMAP *_mouse_sprite, *_mouse_pointer;
|
||||
extern int _mouse_x_focus, _mouse_y_focus;
|
||||
extern int _mouse_width, _mouse_height;
|
||||
|
||||
|
||||
/* various bits of timer stuff */
|
||||
extern int _timer_use_retrace;
|
||||
extern volatile int _retrace_hpp_value;
|
||||
|
||||
|
||||
/* caches and tables for svga bank switching */
|
||||
extern int _last_bank_1, _last_bank_2;
|
||||
extern int *_gfx_bank;
|
||||
|
||||
|
||||
/* bank switching routines */
|
||||
void _stub_bank_switch (void);
|
||||
void _stub_bank_switch_end(void);
|
||||
|
||||
|
||||
/* stuff for setting up bitmaps */
|
||||
void _check_gfx_virginity(void);
|
||||
BITMAP *_make_bitmap(int w, int h, unsigned long addr, GFX_DRIVER *driver, int color_depth, int bpl);
|
||||
void _sort_out_virtual_width(int *width, GFX_DRIVER *driver);
|
||||
|
||||
GFX_VTABLE *_get_vtable(int color_depth);
|
||||
|
||||
extern GFX_VTABLE _screen_vtable;
|
||||
|
||||
extern int _sub_bitmap_id_count;
|
||||
|
||||
extern int _textmode;
|
||||
|
||||
#define BYTES_PER_PIXEL(bpp) (((int)(bpp) + 7) / 8)
|
||||
|
||||
int _color_load_depth(int depth);
|
||||
|
||||
extern int _color_conv;
|
||||
|
||||
BITMAP *_fixup_loaded_bitmap(BITMAP *bmp, PALETTE pal, int bpp);
|
||||
|
||||
|
||||
/* VGA register access routines */
|
||||
void _vga_vsync(void);
|
||||
void _vga_set_pallete_range(PALLETE p, int from, int to, int vsync);
|
||||
|
||||
extern int _crtc;
|
||||
|
||||
|
||||
/* _read_vga_register:
|
||||
* Reads the contents of a VGA register.
|
||||
*/
|
||||
__INLINE__ int _read_vga_register(int port, int index)
|
||||
{
|
||||
if (port==0x3C0)
|
||||
inportb(_crtc+6);
|
||||
|
||||
outportb(port, index);
|
||||
return inportb(port+1);
|
||||
}
|
||||
|
||||
|
||||
/* _write_vga_register:
|
||||
* Writes a byte to a VGA register.
|
||||
*/
|
||||
__INLINE__ void _write_vga_register(int port, int index, int v)
|
||||
{
|
||||
if (port==0x3C0) {
|
||||
inportb(_crtc+6);
|
||||
outportb(port, index);
|
||||
outportb(port, v);
|
||||
}
|
||||
else {
|
||||
outportb(port, index);
|
||||
outportb(port+1, v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* _alter_vga_register:
|
||||
* Alters specific bits of a VGA register.
|
||||
*/
|
||||
__INLINE__ void _alter_vga_register(int port, int index, int mask, int v)
|
||||
{
|
||||
int temp;
|
||||
temp = _read_vga_register(port, index);
|
||||
temp &= (~mask);
|
||||
temp |= (v & mask);
|
||||
_write_vga_register(port, index, temp);
|
||||
}
|
||||
|
||||
|
||||
/* _vsync_out_h:
|
||||
* Waits until the VGA is not in either a vertical or horizontal retrace.
|
||||
*/
|
||||
__INLINE__ void _vsync_out_h(void)
|
||||
{
|
||||
do {
|
||||
} while (inportb(0x3DA) & 1);
|
||||
}
|
||||
|
||||
|
||||
/* _vsync_out_v:
|
||||
* Waits until the VGA is not in a vertical retrace.
|
||||
*/
|
||||
__INLINE__ void _vsync_out_v(void)
|
||||
{
|
||||
do {
|
||||
} while (inportb(0x3DA) & 8);
|
||||
}
|
||||
|
||||
|
||||
/* _vsync_in:
|
||||
* Waits until the VGA is in the vertical retrace period.
|
||||
*/
|
||||
__INLINE__ void _vsync_in(void)
|
||||
{
|
||||
if (_timer_use_retrace) {
|
||||
int t = retrace_count;
|
||||
|
||||
do {
|
||||
} while (t == retrace_count);
|
||||
}
|
||||
else {
|
||||
do {
|
||||
} while (!(inportb(0x3DA) & 8));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* _write_hpp:
|
||||
* Writes to the VGA pelpan register.
|
||||
*/
|
||||
__INLINE__ void _write_hpp(int value)
|
||||
{
|
||||
if (_timer_use_retrace) {
|
||||
_retrace_hpp_value = value;
|
||||
|
||||
do {
|
||||
} while (_retrace_hpp_value == value);
|
||||
}
|
||||
else {
|
||||
do {
|
||||
} while (!(inportb(0x3DA) & 8));
|
||||
|
||||
_write_vga_register(0x3C0, 0x33, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void _set_vga_virtual_width(int old_width, int new_width);
|
||||
|
||||
|
||||
/* current drawing mode */
|
||||
extern int _drawing_mode;
|
||||
extern BITMAP *_drawing_pattern;
|
||||
extern int _drawing_x_anchor;
|
||||
extern int _drawing_y_anchor;
|
||||
extern unsigned int _drawing_x_mask;
|
||||
extern unsigned int _drawing_y_mask;
|
||||
|
||||
|
||||
/* graphics drawing routines */
|
||||
void _normal_line(BITMAP *bmp, int x1, int y1, int x2, int y2, int color);
|
||||
void _normal_rectfill(BITMAP *bmp, int x1, int y1, int x2, int y2, int color);
|
||||
|
||||
int _linear_getpixel8(struct BITMAP *bmp, int x, int y);
|
||||
void _linear_putpixel8(struct BITMAP *bmp, int x, int y, int color);
|
||||
void _linear_vline8(struct BITMAP *bmp, int x, int y1, int y2, int color);
|
||||
void _linear_hline8(struct BITMAP *bmp, int x1, int y, int x2, int color);
|
||||
void _linear_draw_sprite8(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_sprite_v_flip8(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_sprite_h_flip8(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_sprite_vh_flip8(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_trans_sprite8(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_lit_sprite8(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
|
||||
void _linear_draw_rle_sprite8(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
|
||||
void _linear_draw_trans_rle_sprite8(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
|
||||
void _linear_draw_lit_rle_sprite8(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y, int color);
|
||||
void _linear_draw_character8(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
|
||||
void _linear_textout_fixed8(struct BITMAP *bmp, void *f, int h, unsigned char *str, int x, int y, int color);
|
||||
void _linear_blit8(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _linear_blit_backward8(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _linear_masked_blit8(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _linear_clear_to_color8(struct BITMAP *bitmap, int color);
|
||||
|
||||
#ifdef ALLEGRO_COLOR16
|
||||
|
||||
void _linear_putpixel15(struct BITMAP *bmp, int x, int y, int color);
|
||||
void _linear_vline15(struct BITMAP *bmp, int x, int y1, int y2, int color);
|
||||
void _linear_hline15(struct BITMAP *bmp, int x1, int y, int x2, int color);
|
||||
void _linear_draw_trans_sprite15(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_lit_sprite15(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
|
||||
void _linear_draw_rle_sprite15(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
|
||||
void _linear_draw_trans_rle_sprite15(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
|
||||
void _linear_draw_lit_rle_sprite15(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y, int color);
|
||||
|
||||
int _linear_getpixel16(struct BITMAP *bmp, int x, int y);
|
||||
void _linear_putpixel16(struct BITMAP *bmp, int x, int y, int color);
|
||||
void _linear_vline16(struct BITMAP *bmp, int x, int y1, int y2, int color);
|
||||
void _linear_hline16(struct BITMAP *bmp, int x1, int y, int x2, int color);
|
||||
void _linear_draw_sprite16(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_256_sprite16(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_sprite_v_flip16(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_sprite_h_flip16(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_sprite_vh_flip16(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_trans_sprite16(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_lit_sprite16(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
|
||||
void _linear_draw_rle_sprite16(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
|
||||
void _linear_draw_trans_rle_sprite16(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
|
||||
void _linear_draw_lit_rle_sprite16(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y, int color);
|
||||
void _linear_draw_character16(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
|
||||
void _linear_textout_fixed16(struct BITMAP *bmp, void *f, int h, unsigned char *str, int x, int y, int color);
|
||||
void _linear_blit16(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _linear_blit_backward16(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _linear_masked_blit16(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _linear_clear_to_color16(struct BITMAP *bitmap, int color);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ALLEGRO_COLOR24
|
||||
|
||||
int _linear_getpixel24(struct BITMAP *bmp, int x, int y);
|
||||
void _linear_putpixel24(struct BITMAP *bmp, int x, int y, int color);
|
||||
void _linear_vline24(struct BITMAP *bmp, int x, int y1, int y2, int color);
|
||||
void _linear_hline24(struct BITMAP *bmp, int x1, int y, int x2, int color);
|
||||
void _linear_draw_sprite24(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_256_sprite24(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_sprite_v_flip24(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_sprite_h_flip24(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_sprite_vh_flip24(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_trans_sprite24(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_lit_sprite24(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
|
||||
void _linear_draw_rle_sprite24(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
|
||||
void _linear_draw_trans_rle_sprite24(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
|
||||
void _linear_draw_lit_rle_sprite24(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y, int color);
|
||||
void _linear_draw_character24(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
|
||||
void _linear_textout_fixed24(struct BITMAP *bmp, void *f, int h, unsigned char *str, int x, int y, int color);
|
||||
void _linear_blit24(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _linear_blit_backward24(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _linear_masked_blit24(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _linear_clear_to_color24(struct BITMAP *bitmap, int color);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ALLEGRO_COLOR32
|
||||
|
||||
int _linear_getpixel32(struct BITMAP *bmp, int x, int y);
|
||||
void _linear_putpixel32(struct BITMAP *bmp, int x, int y, int color);
|
||||
void _linear_vline32(struct BITMAP *bmp, int x, int y1, int y2, int color);
|
||||
void _linear_hline32(struct BITMAP *bmp, int x1, int y, int x2, int color);
|
||||
void _linear_draw_sprite32(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_256_sprite32(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_sprite_v_flip32(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_sprite_h_flip32(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_sprite_vh_flip32(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_trans_sprite32(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _linear_draw_lit_sprite32(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
|
||||
void _linear_draw_rle_sprite32(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
|
||||
void _linear_draw_trans_rle_sprite32(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
|
||||
void _linear_draw_lit_rle_sprite32(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y, int color);
|
||||
void _linear_draw_character32(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
|
||||
void _linear_textout_fixed32(struct BITMAP *bmp, void *f, int h, unsigned char *str, int x, int y, int color);
|
||||
void _linear_blit32(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _linear_blit_backward32(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _linear_masked_blit32(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _linear_clear_to_color32(struct BITMAP *bitmap, int color);
|
||||
|
||||
#endif
|
||||
|
||||
int _x_getpixel(struct BITMAP *bmp, int x, int y);
|
||||
void _x_putpixel(struct BITMAP *bmp, int x, int y, int color);
|
||||
void _x_vline(struct BITMAP *bmp, int x, int y1, int y2, int color);
|
||||
void _x_hline(struct BITMAP *bmp, int x1, int y, int x2, int color);
|
||||
void _x_draw_sprite(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _x_draw_sprite_v_flip(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _x_draw_sprite_h_flip(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _x_draw_sprite_vh_flip(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _x_draw_trans_sprite(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
|
||||
void _x_draw_lit_sprite(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
|
||||
void _x_draw_rle_sprite(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
|
||||
void _x_draw_trans_rle_sprite(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
|
||||
void _x_draw_lit_rle_sprite(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y, int color);
|
||||
void _x_draw_character(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
|
||||
void _x_textout_fixed(struct BITMAP *bmp, void *f, int h, unsigned char *str, int x, int y, int color);
|
||||
void _x_blit_from_memory(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _x_blit_to_memory(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _x_blit(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _x_blit_forward(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _x_blit_backward(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _x_masked_blit(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
|
||||
void _x_clear_to_color(struct BITMAP *bitmap, int color);
|
||||
|
||||
|
||||
/* asm helper for stretch_blit() */
|
||||
void _do_stretch(BITMAP *source, BITMAP *dest, void *drawer, int sx, fixed sy, fixed syd, int dx, int dy, int dh, int color_depth);
|
||||
|
||||
|
||||
/* number of fractional bits used by the polygon rasteriser */
|
||||
#define POLYGON_FIX_SHIFT 18
|
||||
|
||||
|
||||
/* bitfield specifying which polygon attributes need interpolating */
|
||||
#define INTERP_FLAT 1
|
||||
#define INTERP_1COL 2
|
||||
#define INTERP_3COL 4
|
||||
#define INTERP_FIX_UV 8
|
||||
#define INTERP_Z 16
|
||||
#define INTERP_FLOAT_UV 32
|
||||
#define OPT_FLOAT_UV_TO_FIX 64
|
||||
#define COLOR_TO_RGB 128
|
||||
|
||||
|
||||
/* information for polygon scanline fillers */
|
||||
typedef struct POLYGON_SEGMENT
|
||||
{
|
||||
fixed u, v, du, dv; /* fixed point u/v coordinates */
|
||||
fixed c, dc; /* single color gouraud shade values */
|
||||
fixed r, g, b, dr, dg, db; /* RGB gouraud shade values */
|
||||
float z, dz; /* polygon depth (1/z) */
|
||||
float fu, fv, dfu, dfv; /* floating point u/v coordinates */
|
||||
unsigned char *texture; /* the texture map */
|
||||
int umask, vmask, vshift; /* texture map size information */
|
||||
int seg; /* destination bitmap selector */
|
||||
} POLYGON_SEGMENT;
|
||||
|
||||
|
||||
/* an active polygon edge */
|
||||
typedef struct POLYGON_EDGE
|
||||
{
|
||||
int top; /* top y position */
|
||||
int bottom; /* bottom y position */
|
||||
fixed x, dx; /* fixed point x position and gradient */
|
||||
fixed w; /* width of line segment */
|
||||
POLYGON_SEGMENT dat; /* texture/gouraud information */
|
||||
struct POLYGON_EDGE *prev; /* doubly linked list */
|
||||
struct POLYGON_EDGE *next;
|
||||
} POLYGON_EDGE;
|
||||
|
||||
|
||||
/* prototype for the scanline filler functions */
|
||||
typedef void (*SCANLINE_FILLER)(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
|
||||
|
||||
/* polygon helper functions */
|
||||
extern SCANLINE_FILLER _optim_alternative_drawer;
|
||||
POLYGON_EDGE *_add_edge(POLYGON_EDGE *list, POLYGON_EDGE *edge, int sort_by_x);
|
||||
POLYGON_EDGE *_remove_edge(POLYGON_EDGE *list, POLYGON_EDGE *edge);
|
||||
void _fill_3d_edge_structure(POLYGON_EDGE *edge, V3D *v1, V3D *v2, int flags, BITMAP *bmp);
|
||||
void _fill_3d_edge_structure_f(POLYGON_EDGE *edge, V3D_f *v1, V3D_f *v2, int flags, BITMAP *bmp);
|
||||
SCANLINE_FILLER _get_scanline_filler(int type, int *flags, POLYGON_SEGMENT *info, BITMAP *texture, BITMAP *bmp);
|
||||
void _clip_polygon_segment(POLYGON_SEGMENT *info, int gap, int flags);
|
||||
|
||||
|
||||
/* polygon scanline filler functions */
|
||||
void _poly_scanline_gcol8(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_grgb8(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex8(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex8(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_mask8(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask8(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_lit8(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_lit8(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_mask_lit8(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask_lit8(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
|
||||
void _poly_scanline_grgb8x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
|
||||
void _poly_scanline_grgb15(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_mask15(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask15(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_lit15(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_lit15(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_mask_lit15(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask_lit15(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
|
||||
void _poly_scanline_grgb15x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_lit15x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_lit15x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_mask_lit15x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask_lit15x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
|
||||
void _poly_scanline_ptex_lit15d(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask_lit15d(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
|
||||
void _poly_scanline_grgb16(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex16(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex16(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_mask16(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask16(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_lit16(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_lit16(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_mask_lit16(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask_lit16(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
|
||||
void _poly_scanline_grgb16x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_lit16x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_lit16x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_mask_lit16x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask_lit16x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
|
||||
void _poly_scanline_ptex_lit16d(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask_lit16d(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
|
||||
void _poly_scanline_grgb24(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex24(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex24(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_mask24(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask24(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_lit24(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_lit24(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_mask_lit24(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask_lit24(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
|
||||
void _poly_scanline_grgb24x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_lit24x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_lit24x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_mask_lit24x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask_lit24x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
|
||||
void _poly_scanline_ptex_lit24d(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask_lit24d(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
|
||||
void _poly_scanline_grgb32(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex32(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex32(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_mask32(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask32(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_lit32(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_lit32(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_mask_lit32(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask_lit32(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
|
||||
void _poly_scanline_grgb32x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_lit32x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_lit32x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_atex_mask_lit32x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask_lit32x(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
|
||||
void _poly_scanline_ptex_lit32d(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
void _poly_scanline_ptex_mask_lit32d(unsigned long addr, int w, POLYGON_SEGMENT *info);
|
||||
|
||||
|
||||
/* sound lib stuff */
|
||||
extern int _digi_volume;
|
||||
extern int _midi_volume;
|
||||
extern int _flip_pan;
|
||||
extern int _sound_hq;
|
||||
|
||||
extern int (*_midi_init)(void);
|
||||
extern void (*_midi_exit)(void);
|
||||
|
||||
int _midi_allocate_voice(int min, int max);
|
||||
|
||||
extern volatile long _midi_tick;
|
||||
|
||||
int _digmid_find_patches(char *dir, char *file);
|
||||
|
||||
#define VIRTUAL_VOICES 256
|
||||
|
||||
|
||||
typedef struct /* a virtual (as seen by the user) soundcard voice */
|
||||
{
|
||||
SAMPLE *sample; /* which sample are we playing? (NULL = free) */
|
||||
int num; /* physical voice number (-1 = been killed off) */
|
||||
int autokill; /* set to free the voice when the sample finishes */
|
||||
long time; /* when we were started (for voice allocation) */
|
||||
int priority; /* how important are we? */
|
||||
} VOICE;
|
||||
|
||||
extern VOICE _voice[VIRTUAL_VOICES];
|
||||
|
||||
|
||||
typedef struct /* a physical (as used by hardware) soundcard voice */
|
||||
{
|
||||
int num; /* the virtual voice currently using me (-1 = free) */
|
||||
int playmode; /* are we looping? */
|
||||
int vol; /* current volume (fixed point .12) */
|
||||
int dvol; /* volume delta, for ramping */
|
||||
int target_vol; /* target volume, for ramping */
|
||||
int pan; /* current pan (fixed point .12) */
|
||||
int dpan; /* pan delta, for sweeps */
|
||||
int target_pan; /* target pan, for sweeps */
|
||||
int freq; /* current frequency (fixed point .12) */
|
||||
int dfreq; /* frequency delta, for sweeps */
|
||||
int target_freq; /* target frequency, for sweeps */
|
||||
} PHYS_VOICE;
|
||||
|
||||
extern PHYS_VOICE _phys_voice[DIGI_VOICES];
|
||||
|
||||
|
||||
#define MIXER_DEF_SFX 8
|
||||
#define MIXER_MAX_SFX 64
|
||||
|
||||
int _mixer_init(int bufsize, int freq, int stereo, int is16bit, int *voices);
|
||||
void _mixer_exit(void);
|
||||
void _mix_some_samples(unsigned long buf, unsigned short seg, int issigned);
|
||||
|
||||
void _mixer_init_voice(int voice, SAMPLE *sample);
|
||||
void _mixer_release_voice(int voice);
|
||||
void _mixer_start_voice(int voice);
|
||||
void _mixer_stop_voice(int voice);
|
||||
void _mixer_loop_voice(int voice, int loopmode);
|
||||
int _mixer_get_position(int voice);
|
||||
void _mixer_set_position(int voice, int position);
|
||||
int _mixer_get_volume(int voice);
|
||||
void _mixer_set_volume(int voice, int volume);
|
||||
void _mixer_ramp_volume(int voice, int time, int endvol);
|
||||
void _mixer_stop_volume_ramp(int voice);
|
||||
int _mixer_get_frequency(int voice);
|
||||
void _mixer_set_frequency(int voice, int frequency);
|
||||
void _mixer_sweep_frequency(int voice, int time, int endfreq);
|
||||
void _mixer_stop_frequency_sweep(int voice);
|
||||
int _mixer_get_pan(int voice);
|
||||
void _mixer_set_pan(int voice, int pan);
|
||||
void _mixer_sweep_pan(int voice, int time, int endpan);
|
||||
void _mixer_stop_pan_sweep(int voice);
|
||||
void _mixer_set_echo(int voice, int strength, int delay);
|
||||
void _mixer_set_tremolo(int voice, int rate, int depth);
|
||||
void _mixer_set_vibrato(int voice, int rate, int depth);
|
||||
|
||||
/* dummy functions for the NoSound drivers */
|
||||
int _dummy_detect(int input);
|
||||
int _dummy_init(int input, int voices);
|
||||
void _dummy_exit(int input);
|
||||
int _dummy_mixer_volume(int volume);
|
||||
void _dummy_init_voice(int voice, SAMPLE *sample);
|
||||
void _dummy_noop1(int p);
|
||||
void _dummy_noop2(int p1, int p2);
|
||||
void _dummy_noop3(int p1, int p2, int p3);
|
||||
int _dummy_get_position(int voice);
|
||||
int _dummy_get(int voice);
|
||||
void _dummy_raw_midi(unsigned char data);
|
||||
int _dummy_load_patches(char *patches, char *drums);
|
||||
void _dummy_adjust_patches(char *patches, char *drums);
|
||||
void _dummy_key_on(int inst, int note, int bend, int vol, int pan);
|
||||
|
||||
|
||||
/* from djgpp's libc, needed to find which directory we were run from */
|
||||
extern int __crt0_argc;
|
||||
extern char **__crt0_argv;
|
||||
|
||||
|
||||
#endif /* ifndef INTERNAL_H */
|
||||
@@ -1,22 +0,0 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 2005-2018 by Sonic Team Jr.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief Set Com port and speed for GDBStubs for DJGGP
|
||||
///
|
||||
/// copy and rename as rdb.h and set the defines below as needed
|
||||
|
||||
#define DEBUG_COM_PORT 2
|
||||
#define DEBUG_COM_PORT_SPEED 9600
|
||||
@@ -1,900 +0,0 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief extended vesa VESA2.0 video modes i/o
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../i_system.h" //I_Error()
|
||||
#include "vid_vesa.h"
|
||||
#include "../doomdef.h" //MAXVIDWIDTH, MAXVIDHEIGHT
|
||||
#include "../screen.h"
|
||||
|
||||
#include <dpmi.h>
|
||||
#include <go32.h>
|
||||
#include <sys/farptr.h>
|
||||
#include <sys/movedata.h>
|
||||
#include <sys/segments.h>
|
||||
#include <sys/nearptr.h>
|
||||
|
||||
#include "../console.h"
|
||||
#include "../command.h" //added:21-03-98: vid_xxx commands
|
||||
#include "../i_video.h"
|
||||
|
||||
|
||||
// PROTOS
|
||||
static vmode_t *VID_GetModePtr (int modenum);
|
||||
static int VID_VesaGetModeInfo (int modenum);
|
||||
static void VID_VesaGetExtraModes (void);
|
||||
static INT32 VID_VesaInitMode (viddef_t *lvid, vmode_t *pcurrentmode);
|
||||
|
||||
static void VID_Command_NumModes_f (void);
|
||||
static void VID_Command_ModeInfo_f (void);
|
||||
static void VID_Command_ModeList_f (void);
|
||||
static void VID_Command_Mode_f (void);
|
||||
|
||||
consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
static consvar_t cv_stretch = {"stretch", "On", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#define VBEVERSION 2 // we need vesa2 or higher
|
||||
|
||||
// -----------------------------------------------------
|
||||
#define MASK_LINEAR(addr) (addr & 0x000FFFFF)
|
||||
#define RM_TO_LINEAR(addr) (((addr & 0xFFFF0000) >> 12) + (addr & 0xFFFF))
|
||||
#define RM_OFFSET(addr) (addr & 0xF)
|
||||
#define RM_SEGMENT(addr) ((addr >> 4) & 0xFFFF)
|
||||
// -----------------------------------------------------
|
||||
|
||||
static int totalvidmem;
|
||||
|
||||
static vmode_t vesa_modes[MAX_VESA_MODES] = {{NULL, NULL, 0, 0, 0, 0, 0, 0, NULL, NULL, 0}};
|
||||
static vesa_extra_t vesa_extra[MAX_VESA_MODES];
|
||||
|
||||
//this is the only supported non-vesa mode : standard 320x200x256c.
|
||||
#define NUMVGAVIDMODES 1
|
||||
static INT32 VGA_InitMode (viddef_t *lvid, vmode_t *pcurrentmode);
|
||||
static char vgamode1[] ="320x200";
|
||||
static vmode_t vgavidmodes[NUMVGAVIDMODES] = {
|
||||
{
|
||||
NULL,
|
||||
vgamode1,
|
||||
320, 200, //(200.0/320.0)*(320.0/240.0),
|
||||
320, 1, // rowbytes, bytes per pixel
|
||||
0, 1,
|
||||
NULL,
|
||||
VGA_InitMode, 0
|
||||
}
|
||||
};
|
||||
|
||||
static char names[MAX_VESA_MODES][10];
|
||||
|
||||
//----------------------------i_video.c------------------------------------
|
||||
// these ones should go to i_video.c, but I prefer keep them away from the
|
||||
// doom sources until the vesa stuff is ok.
|
||||
static int numvidmodes; //total number of video modes, vga, vesa1, vesa2.
|
||||
static vmode_t *pvidmodes; //start of videomodes list.
|
||||
static vmode_t *pcurrentmode; // the current active videomode.
|
||||
//----------------------------i_video.c------------------------------------
|
||||
|
||||
|
||||
|
||||
// table des modes videos.
|
||||
// seul le mode 320x200x256c standard VGA est support� sans le VESA.
|
||||
// ce mode est le mode num�ro 0 dans la liste.
|
||||
typedef struct
|
||||
{
|
||||
int modenum; // vesa vbe2.0 modenum
|
||||
int mode_attributes;
|
||||
int winasegment;
|
||||
int winbsegment;
|
||||
int bytes_per_scanline; // bytes per logical scanline (+16)
|
||||
int win; // window number (A=0, B=1)
|
||||
int win_size; // window size (+6)
|
||||
int granularity; // how finely i can set the window in vid mem (+4)
|
||||
int width, height; // displayed width and height (+18, +20)
|
||||
int bits_per_pixel; // er, better be 8, 15, 16, 24, or 32 (+25)
|
||||
int bytes_per_pixel; // er, better be 1, 2, or 4
|
||||
int memory_model; // and better be 4 or 6, packed or direct color (+27)
|
||||
int num_pages; // number of complete frame buffer pages (+29)
|
||||
int red_width; // the # of bits in the red component (+31)
|
||||
int red_pos; // the bit position of the red component (+32)
|
||||
int green_width; // etc.. (+33)
|
||||
int green_pos; // (+34)
|
||||
int blue_width; // (+35)
|
||||
int blue_pos; // (+36)
|
||||
int pptr;
|
||||
int pagesize;
|
||||
int numpages;
|
||||
} modeinfo_t;
|
||||
|
||||
static vbeinfoblock_t vesainfo;
|
||||
static vesamodeinfo_t vesamodeinfo;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// DOS stuff
|
||||
// ------------------------------------------------------------------------
|
||||
static unsigned long conventional_memory = (unsigned long)-1;
|
||||
|
||||
FUNCINLINE static ATTRINLINE void map_in_conventional_memory(void)
|
||||
{
|
||||
if (conventional_memory == (unsigned long)-1)
|
||||
{
|
||||
if (__djgpp_nearptr_enable())
|
||||
{
|
||||
conventional_memory = __djgpp_conventional_base;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Converts a flat 32 bit ptr to a realmode 0x12345 type ptr (seg<<4 + offs)
|
||||
#if 0
|
||||
unsigned int ptr2real(void *ptr)
|
||||
{
|
||||
map_in_conventional_memory();
|
||||
return (int)ptr - conventional_memory;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Converts 0x12345 (seg<<4+offs) realmode ptr to a flat 32bit ptr
|
||||
FUNCINLINE static ATTRINLINE void *real2ptr(unsigned int real)
|
||||
{
|
||||
map_in_conventional_memory();
|
||||
return (void *) (real + conventional_memory);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
/* ======================================================================== */
|
||||
// Add the standard VGA video modes (only one now) to the video modes list.
|
||||
/* ======================================================================== */
|
||||
static inline void VGA_Init(void)
|
||||
{
|
||||
vgavidmodes[NUMVGAVIDMODES-1].pnext = pvidmodes;
|
||||
pvidmodes = &vgavidmodes[0];
|
||||
numvidmodes += NUMVGAVIDMODES;
|
||||
}
|
||||
|
||||
|
||||
//added:30-01-98: return number of video modes in pvidmodes list
|
||||
INT32 VID_NumModes(void)
|
||||
{
|
||||
return numvidmodes;
|
||||
}
|
||||
|
||||
//added:21-03-98: return info on video mode
|
||||
FUNCINLINE static ATTRINLINE const char *VID_ModeInfo (int modenum, char **ppheader)
|
||||
{
|
||||
static const char *badmodestr = "Bad video mode number\n";
|
||||
vmode_t *pv;
|
||||
|
||||
pv = VID_GetModePtr (modenum);
|
||||
|
||||
if (!pv)
|
||||
{
|
||||
if (ppheader)
|
||||
*ppheader = NULL;
|
||||
return badmodestr;
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (ppheader)
|
||||
// *ppheader = pv->header;
|
||||
return pv->name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//added:03-02-98: return a video mode number from the dimensions
|
||||
INT32 VID_GetModeForSize( INT32 w, INT32 h)
|
||||
{
|
||||
vmode_t *pv;
|
||||
int modenum;
|
||||
|
||||
pv = pvidmodes;
|
||||
for (modenum=0; pv!=NULL; pv=pv->pnext,modenum++ )
|
||||
{
|
||||
if ( pv->width==(unsigned)w && pv->height==(unsigned)h )
|
||||
return modenum;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* ======================================================================== */
|
||||
//
|
||||
/* ======================================================================== */
|
||||
void VID_Init (void)
|
||||
{
|
||||
COM_AddCommand ("vid_nummodes", VID_Command_NumModes_f);
|
||||
COM_AddCommand ("vid_modeinfo", VID_Command_ModeInfo_f);
|
||||
COM_AddCommand ("vid_modelist", VID_Command_ModeList_f);
|
||||
COM_AddCommand ("vid_mode", VID_Command_Mode_f);
|
||||
CV_RegisterVar (&cv_vidwait);
|
||||
CV_RegisterVar (&cv_stretch);
|
||||
|
||||
//setup the videmodes list,
|
||||
// note that mode 0 must always be VGA mode 0x13
|
||||
pvidmodes = NULL;
|
||||
pcurrentmode = NULL;
|
||||
numvidmodes = 0;
|
||||
// setup the vesa_modes list
|
||||
VID_VesaGetExtraModes ();
|
||||
|
||||
// the game boots in 320x200 standard VGA, but
|
||||
// we need a highcolor mode to run the game in highcolor
|
||||
if (highcolor && numvidmodes==0)
|
||||
I_Error ("No 15bit highcolor VESA2 video mode found, cannot run in highcolor.\n");
|
||||
|
||||
// add the vga modes at the start of the modes list
|
||||
VGA_Init();
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
CONS_Printf("VID_SetMode(%d)\n",vid.modenum);
|
||||
#endif
|
||||
VID_SetMode (0); //vid.modenum);
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
CONS_Printf("after VID_SetMode\n");
|
||||
CONS_Printf("vid.width %d\n",vid.width);
|
||||
CONS_Printf("vid.height %d\n",vid.height);
|
||||
CONS_Printf("vid.buffer %x\n",vid.buffer);
|
||||
CONS_Printf("vid.rowbytes %d\n",vid.rowbytes);
|
||||
CONS_Printf("vid.numpages %d\n",vid.numpages);
|
||||
CONS_Printf("vid.recalc %d\n",vid.recalc);
|
||||
CONS_Printf("vid.direct %x\n",vid.direct);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ========================================================================
|
||||
// Returns a vmode_t from the video modes list, given a video mode number.
|
||||
// ========================================================================
|
||||
vmode_t *VID_GetModePtr (int modenum)
|
||||
{
|
||||
vmode_t *pv;
|
||||
|
||||
pv = pvidmodes;
|
||||
if (!pv)
|
||||
I_Error ("VID_error 1\n");
|
||||
|
||||
while (modenum--)
|
||||
{
|
||||
pv = pv->pnext;
|
||||
if (!pv)
|
||||
I_Error ("VID_error 2\n");
|
||||
}
|
||||
|
||||
return pv;
|
||||
}
|
||||
|
||||
|
||||
//added:30-01-98:return the name of a video mode
|
||||
const char *VID_GetModeName (INT32 modenum)
|
||||
{
|
||||
return (VID_GetModePtr(modenum))->name;
|
||||
}
|
||||
|
||||
|
||||
// ========================================================================
|
||||
// Sets a video mode
|
||||
// ========================================================================
|
||||
INT32 VID_SetMode (INT32 modenum) //, UINT8 *palette)
|
||||
{
|
||||
int vstat;
|
||||
vmode_t *pnewmode, *poldmode;
|
||||
|
||||
if ((modenum >= numvidmodes) || (modenum < 0))
|
||||
{
|
||||
if (pcurrentmode == NULL)
|
||||
{
|
||||
modenum = 0; // mode hasn't been set yet, so initialize to base
|
||||
// mode since they gave us an invalid initial mode
|
||||
}
|
||||
else
|
||||
{
|
||||
//nomodecheck = true;
|
||||
I_Error ("Unknown video mode: %d\n", modenum);
|
||||
//nomodecheck = false;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
pnewmode = VID_GetModePtr (modenum);
|
||||
|
||||
if (pnewmode == pcurrentmode)
|
||||
return 1; // already in the desired mode
|
||||
|
||||
// initialize the new mode
|
||||
poldmode = pcurrentmode;
|
||||
pcurrentmode = pnewmode;
|
||||
|
||||
// initialize vidbuffer size for setmode
|
||||
vid.width = pcurrentmode->width;
|
||||
vid.height = pcurrentmode->height;
|
||||
//vid.aspect = pcurrentmode->aspect;
|
||||
vid.rowbytes = pcurrentmode->rowbytes;
|
||||
vid.bpp = pcurrentmode->bytesperpixel;
|
||||
|
||||
//debug
|
||||
//if (vid.rowbytes != vid.width)
|
||||
// I_Error("vidrowbytes (%d) <> vidwidth(%d)\n",vid.rowbytes,vid.width);
|
||||
|
||||
vstat = (*pcurrentmode->setmode) (&vid, pcurrentmode);
|
||||
|
||||
if (vstat < 1)
|
||||
{
|
||||
if (vstat == 0)
|
||||
{
|
||||
// harware could not setup mode
|
||||
//if (!VID_SetMode (vid.modenum))
|
||||
// I_Error ("VID_SetMode: couldn't set video mode (hard failure)");
|
||||
I_Error("Couldn't set video mode %d\n", modenum);
|
||||
}
|
||||
else
|
||||
if (vstat == -1)
|
||||
{
|
||||
CONS_Printf ("Not enough mem for VID_SetMode...\n");
|
||||
|
||||
// not enough memory; just put things back the way they were
|
||||
pcurrentmode = poldmode;
|
||||
vid.width = pcurrentmode->width;
|
||||
vid.height = pcurrentmode->height;
|
||||
vid.rowbytes = pcurrentmode->rowbytes;
|
||||
vid.bpp = pcurrentmode->bytesperpixel;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
vid.modenum = modenum;
|
||||
|
||||
//printf ("%s\n", VID_ModeInfo (vid.modenum, NULL));
|
||||
|
||||
//added:20-01-98: recalc all tables and realloc buffers based on
|
||||
// vid values.
|
||||
vid.recalc = 1;
|
||||
|
||||
if (!cv_stretch.value && (float)vid.width/vid.height != ((float)BASEVIDWIDTH/BASEVIDHEIGHT))
|
||||
vid.height = (int)(vid.width * ((float)BASEVIDHEIGHT/BASEVIDWIDTH));// Adjust the height to match
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// converts a segm:offs 32bit pair to a 32bit flat ptr
|
||||
#if 0
|
||||
void *VID_ExtraFarToLinear (void *ptr)
|
||||
{
|
||||
int temp;
|
||||
|
||||
temp = (int)ptr;
|
||||
return real2ptr (((temp & 0xFFFF0000) >> 12) + (temp & 0xFFFF));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// ========================================================================
|
||||
// Helper function for VID_VesaGetExtraModes
|
||||
// In: vesa mode number, from the vesa videomodenumbers list
|
||||
// Out: false, if no info for given modenum
|
||||
// ========================================================================
|
||||
int VID_VesaGetModeInfo (int modenum)
|
||||
{
|
||||
int bytes_per_pixel;
|
||||
unsigned int i;
|
||||
__dpmi_regs regs;
|
||||
|
||||
for (i=0; i<sizeof (vesamodeinfo_t); i++)
|
||||
_farpokeb(_dos_ds, MASK_LINEAR(__tb)+i, 0);
|
||||
|
||||
regs.x.ax = 0x4f01;
|
||||
regs.x.di = RM_OFFSET(__tb);
|
||||
regs.x.es = RM_SEGMENT(__tb);
|
||||
regs.x.cx = modenum;
|
||||
__dpmi_int(0x10, ®s);
|
||||
if (regs.h.ah)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
dosmemget (MASK_LINEAR(__tb), sizeof (vesamodeinfo_t), &vesamodeinfo);
|
||||
|
||||
bytes_per_pixel = (vesamodeinfo.BitsPerPixel+1)/8;
|
||||
|
||||
// we add either highcolor or lowcolor video modes, not the two
|
||||
if (highcolor && (vesamodeinfo.BitsPerPixel != 15))
|
||||
return false;
|
||||
if (!highcolor && (vesamodeinfo.BitsPerPixel != 8))
|
||||
return false;
|
||||
|
||||
if ((bytes_per_pixel > 2) ||
|
||||
(vesamodeinfo.XResolution > MAXVIDWIDTH) ||
|
||||
(vesamodeinfo.YResolution > MAXVIDHEIGHT))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// we only want color graphics modes that are supported by the hardware
|
||||
if ((vesamodeinfo.ModeAttributes &
|
||||
(MODE_SUPPORTED_IN_HW | COLOR_MODE | GRAPHICS_MODE) ) !=
|
||||
(MODE_SUPPORTED_IN_HW | COLOR_MODE | GRAPHICS_MODE))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// we only work with linear frame buffers, except for 320x200,
|
||||
// which is linear when banked at 0xA000
|
||||
if (!(vesamodeinfo.ModeAttributes & LINEAR_FRAME_BUFFER))
|
||||
{
|
||||
if ((vesamodeinfo.XResolution != 320) ||
|
||||
(vesamodeinfo.YResolution != 200))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// pagesize
|
||||
if ((vesamodeinfo.BytesPerScanLine * vesamodeinfo.YResolution)
|
||||
> totalvidmem)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
vesamodeinfo.NumberOfImagePages = 1;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
CONS_Printf("VID: (VESA) info for mode 0x%x\n", modeinfo.modenum);
|
||||
CONS_Printf(" mode attrib = 0x%0x\n", modeinfo.mode_attributes);
|
||||
CONS_Printf(" win a attrib = 0x%0x\n", *(UINT8 *)(infobuf+2));
|
||||
CONS_Printf(" win b attrib = 0x%0x\n", *(UINT8 *)(infobuf+3));
|
||||
CONS_Printf(" win a seg 0x%0x\n", (int) modeinfo.winasegment);
|
||||
CONS_Printf(" win b seg 0x%0x\n", (int) modeinfo.winbsegment);
|
||||
CONS_Printf(" bytes per scanline = %d\n",
|
||||
modeinfo.bytes_per_scanline);
|
||||
CONS_Printf(" width = %d, height = %d\n", modeinfo.width,
|
||||
modeinfo.height);
|
||||
CONS_Printf(" win = %c\n", 'A' + modeinfo.win);
|
||||
CONS_Printf(" win granularity = %d\n", modeinfo.granularity);
|
||||
CONS_Printf(" win size = %d\n", modeinfo.win_size);
|
||||
CONS_Printf(" bits per pixel = %d\n", modeinfo.bits_per_pixel);
|
||||
CONS_Printf(" bytes per pixel = %d\n", modeinfo.bytes_per_pixel);
|
||||
CONS_Printf(" memory model = 0x%x\n", modeinfo.memory_model);
|
||||
CONS_Printf(" num pages = %d\n", modeinfo.num_pages);
|
||||
CONS_Printf(" red width = %d\n", modeinfo.red_width);
|
||||
CONS_Printf(" red pos = %d\n", modeinfo.red_pos);
|
||||
CONS_Printf(" green width = %d\n", modeinfo.green_width);
|
||||
CONS_Printf(" green pos = %d\n", modeinfo.green_pos);
|
||||
CONS_Printf(" blue width = %d\n", modeinfo.blue_width);
|
||||
CONS_Printf(" blue pos = %d\n", modeinfo.blue_pos);
|
||||
CONS_Printf(" phys mem = %x\n", modeinfo.pptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ========================================================================
|
||||
// Get extended VESA modes information, keep the ones that we support,
|
||||
// so they'll be available in the game Video menu.
|
||||
// ========================================================================
|
||||
#define MAXVESADESC 100
|
||||
static char vesadesc[MAXVESADESC] = "";
|
||||
|
||||
void VID_VesaGetExtraModes (void)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned long addr;
|
||||
int nummodes;
|
||||
__dpmi_meminfo phys_mem_info;
|
||||
unsigned long mode_ptr;
|
||||
__dpmi_regs regs;
|
||||
|
||||
// make a copy of the video modes list! else trash in __tb
|
||||
UINT16 vmode[MAX_VESA_MODES+1];
|
||||
int numvmodes;
|
||||
UINT16 vesamode;
|
||||
|
||||
// new ugly stuff...
|
||||
for (i=0; i<sizeof (vbeinfoblock_t); i++)
|
||||
_farpokeb(_dos_ds, MASK_LINEAR(__tb)+i, 0);
|
||||
|
||||
dosmemput("VBE2", 4, MASK_LINEAR(__tb));
|
||||
|
||||
// see if VESA support is available
|
||||
regs.x.ax = 0x4f00;
|
||||
regs.x.di = RM_OFFSET(__tb);
|
||||
regs.x.es = RM_SEGMENT(__tb);
|
||||
__dpmi_int(0x10, ®s);
|
||||
if (regs.h.ah)
|
||||
goto no_vesa;
|
||||
|
||||
dosmemget(MASK_LINEAR(__tb), sizeof (vbeinfoblock_t), &vesainfo);
|
||||
|
||||
if (strncmp((void *)vesainfo.VESASignature, "VESA", 4) != 0)
|
||||
{
|
||||
no_vesa:
|
||||
CONS_Printf ("No VESA driver\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (vesainfo.VESAVersion < (VBEVERSION<<8))
|
||||
{
|
||||
CONS_Printf ("VESA VBE %d.0 not available\n", VBEVERSION);
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// vesa version number
|
||||
//
|
||||
CONS_Printf ("%4.4s %d.%d (", vesainfo.VESASignature,
|
||||
vesainfo.VESAVersion>>8,
|
||||
vesainfo.VESAVersion&0xFF);
|
||||
|
||||
//
|
||||
// vesa description string
|
||||
//
|
||||
i = 0;
|
||||
addr = RM_TO_LINEAR(vesainfo.OemStringPtr);
|
||||
_farsetsel(_dos_ds);
|
||||
while (_farnspeekb(addr) != 0)
|
||||
{
|
||||
vesadesc[i++] = _farnspeekb(addr++);
|
||||
if (i == MAXVESADESC-1)
|
||||
break;
|
||||
}
|
||||
vesadesc[i]=0;
|
||||
CONS_Printf ("%s)\n",vesadesc);
|
||||
|
||||
totalvidmem = vesainfo.TotalMemory << 16;
|
||||
|
||||
//
|
||||
// find 8 bit modes
|
||||
//
|
||||
numvmodes = 0;
|
||||
mode_ptr = RM_TO_LINEAR(vesainfo.VideoModePtr);
|
||||
while ((vmode[numvmodes] = _farpeekw(_dos_ds, mode_ptr)) != 0xFFFF)
|
||||
{
|
||||
numvmodes++;
|
||||
if ( numvmodes == MAX_VESA_MODES )
|
||||
break;
|
||||
mode_ptr += 2;
|
||||
}
|
||||
vmode[numvmodes] = 0xffff;
|
||||
|
||||
nummodes = 0; // number of video modes accepted for the game
|
||||
|
||||
numvmodes=0; // go again through vmodes table
|
||||
while ( ((vesamode=vmode[numvmodes++]) != 0xFFFF) && (nummodes < MAX_VESA_MODES) )
|
||||
{
|
||||
//fill the modeinfo struct.
|
||||
if (VID_VesaGetModeInfo (vesamode))
|
||||
{
|
||||
vesa_modes[nummodes].pnext = &vesa_modes[nummodes+1];
|
||||
if (vesamodeinfo.XResolution > 999)
|
||||
{
|
||||
if (vesamodeinfo.YResolution > 999)
|
||||
{
|
||||
sprintf (&names[nummodes][0], "%4dx%4d", vesamodeinfo.XResolution,
|
||||
vesamodeinfo.YResolution);
|
||||
names[nummodes][9] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (&names[nummodes][0], "%4dx%3d", vesamodeinfo.XResolution,
|
||||
vesamodeinfo.YResolution);
|
||||
names[nummodes][8] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (vesamodeinfo.YResolution > 999)
|
||||
{
|
||||
sprintf (&names[nummodes][0], "%3dx%4d", vesamodeinfo.XResolution,
|
||||
vesamodeinfo.YResolution);
|
||||
names[nummodes][8] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (&names[nummodes][0], "%3dx%3d", vesamodeinfo.XResolution,
|
||||
vesamodeinfo.YResolution);
|
||||
names[nummodes][7] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
vesa_modes[nummodes].name = &names[nummodes][0];
|
||||
vesa_modes[nummodes].width = vesamodeinfo.XResolution;
|
||||
vesa_modes[nummodes].height = vesamodeinfo.YResolution;
|
||||
|
||||
//added:20-01-98:aspect ratio to be implemented...
|
||||
vesa_modes[nummodes].rowbytes = vesamodeinfo.BytesPerScanLine;
|
||||
vesa_modes[nummodes].windowed = 0;
|
||||
vesa_modes[nummodes].pextradata = &vesa_extra[nummodes];
|
||||
vesa_modes[nummodes].setmode = VID_VesaInitMode;
|
||||
|
||||
if (vesamodeinfo.ModeAttributes & LINEAR_FRAME_BUFFER)
|
||||
{
|
||||
// add linear bit to mode for linear modes
|
||||
vesa_extra[nummodes].vesamode = vesamode | LINEAR_MODE;
|
||||
vesa_modes[nummodes].numpages = 1; //vesamodeinfo.NumberOfImagePages;
|
||||
|
||||
phys_mem_info.address = (int)vesamodeinfo.PhysBasePtr;
|
||||
phys_mem_info.size = 0x400000;
|
||||
|
||||
// returns -1 on error
|
||||
if (__dpmi_physical_address_mapping(&phys_mem_info))
|
||||
{
|
||||
//skip this mode, it doesnt work
|
||||
continue;
|
||||
}
|
||||
|
||||
// if physical mapping was ok... convert the selector:offset
|
||||
vesa_extra[nummodes].plinearmem =
|
||||
real2ptr (phys_mem_info.address);
|
||||
|
||||
// lock the region
|
||||
__dpmi_lock_linear_region (&phys_mem_info);
|
||||
}
|
||||
else
|
||||
{
|
||||
// banked at 0xA0000
|
||||
vesa_extra[nummodes].vesamode = vesamode;
|
||||
//vesa_extra[nummodes].pages[0] = 0;
|
||||
vesa_extra[nummodes].plinearmem =
|
||||
real2ptr (vesamodeinfo.WinASegment<<4);
|
||||
|
||||
vesa_modes[nummodes].numpages = 1; //modeinfo.numpages;
|
||||
}
|
||||
|
||||
vesa_modes[nummodes].bytesperpixel = (vesamodeinfo.BitsPerPixel+1)/8;
|
||||
|
||||
nummodes++;
|
||||
}
|
||||
}
|
||||
|
||||
// add the VESA modes at the start of the mode list (if there are any)
|
||||
if (nummodes)
|
||||
{
|
||||
vesa_modes[nummodes-1].pnext = NULL; //pvidmodes;
|
||||
pvidmodes = &vesa_modes[0];
|
||||
numvidmodes += nummodes;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ========================================================================
|
||||
// Free the video buffer of the last video mode,
|
||||
// allocate a new buffer for the video mode to set.
|
||||
// ========================================================================
|
||||
static boolean VID_FreeAndAllocVidbuffer (viddef_t *lvid)
|
||||
{
|
||||
int vidbuffersize;
|
||||
|
||||
vidbuffersize = (lvid->width * lvid->height * lvid->bpp * NUMSCREENS); //status bar
|
||||
|
||||
// free allocated buffer for previous video mode
|
||||
if (lvid->buffer!=NULL)
|
||||
{
|
||||
free(lvid->buffer);
|
||||
}
|
||||
|
||||
// allocate the new screen buffer
|
||||
if ( (lvid->buffer = (UINT8 *) malloc(vidbuffersize))==NULL )
|
||||
return false;
|
||||
|
||||
// initially clear the video buffer
|
||||
memset (lvid->buffer, 0x00, vidbuffersize);
|
||||
|
||||
#ifdef DEBUG
|
||||
CONS_Printf("VID_FreeAndAllocVidbuffer done, vidbuffersize: %x\n",vidbuffersize);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ========================================================================
|
||||
// Set video mode routine for STANDARD VGA MODES (NO HIGHCOLOR)
|
||||
// Out: 1 ok,
|
||||
// 0 hardware could not set mode,
|
||||
// -1 no mem
|
||||
// ========================================================================
|
||||
static INT32 VGA_InitMode (viddef_t *lvid, vmode_t *currentmodep)
|
||||
{
|
||||
__dpmi_regs regs;
|
||||
|
||||
if (!VID_FreeAndAllocVidbuffer (lvid))
|
||||
return -1; //no mem
|
||||
|
||||
//added:26-01-98: should clear video mem here
|
||||
|
||||
//set mode 0x13
|
||||
regs.h.ah = 0;
|
||||
regs.h.al = 0x13;
|
||||
__dpmi_int(0x10, ®s);
|
||||
|
||||
// here it is the standard VGA 64k window, not an LFB
|
||||
// (you could have 320x200x256c with LFB in the vesa modes)
|
||||
lvid->direct = (UINT8 *) real2ptr (0xa0000);
|
||||
lvid->u.numpages = 1;
|
||||
lvid->bpp = currentmodep->bytesperpixel;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// ========================================================================
|
||||
// Set video mode routine for VESA video modes, see VID_SetMode()
|
||||
// Out: 1 ok,
|
||||
// 0 hardware could not set mode,
|
||||
// -1 no mem
|
||||
// ========================================================================
|
||||
INT32 VID_VesaInitMode (viddef_t *lvid, vmode_t *currentmodep)
|
||||
{
|
||||
vesa_extra_t *pextra;
|
||||
__dpmi_regs regs;
|
||||
|
||||
pextra = currentmodep->pextradata;
|
||||
|
||||
#ifdef DEBUG
|
||||
CONS_Printf("VID_VesaInitMode...\n");
|
||||
CONS_Printf(" currentmodep->name %s\n",currentmodep->name);
|
||||
CONS_Printf(" width %d\n",currentmodep->width);
|
||||
CONS_Printf(" height %d\n",currentmodep->height);
|
||||
CONS_Printf(" rowbytes %d\n",currentmodep->rowbytes);
|
||||
CONS_Printf(" windowed %d\n",currentmodep->windowed);
|
||||
CONS_Printf(" numpages %d\n",currentmodep->numpages);
|
||||
CONS_Printf(" currentmodep->pextradata :\n");
|
||||
CONS_Printf(" ->vesamode %x\n",pextra->vesamode);
|
||||
CONS_Printf(" ->plinearmem %x\n\n",pextra->plinearmem);
|
||||
#endif
|
||||
|
||||
//added:20-01-98:no page flipping now... TO DO!!!
|
||||
lvid->u.numpages = 1;
|
||||
|
||||
// clean up any old vid buffer lying around, alloc new if needed
|
||||
if (!VID_FreeAndAllocVidbuffer (lvid))
|
||||
return -1; //no mem
|
||||
|
||||
|
||||
//added:20-01-98: should clear video mem here
|
||||
|
||||
|
||||
// set the mode
|
||||
regs.x.ax = 0x4f02;
|
||||
regs.x.bx = pextra->vesamode;
|
||||
__dpmi_int (0x10, ®s);
|
||||
|
||||
if (regs.x.ax != 0x4f)
|
||||
return 0; // could not set mode
|
||||
|
||||
//added:20-01-98: should setup wait_vsync flag, currentpage here...
|
||||
// plus check for display_enable bit
|
||||
|
||||
//added:20-01-98: here we should set the page if page flipping...
|
||||
|
||||
// points to LFB, or the start of VGA mem.
|
||||
lvid->direct = pextra->plinearmem;
|
||||
lvid->bpp = currentmodep->bytesperpixel;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// VIDEO MODE CONSOLE COMMANDS
|
||||
// ========================================================================
|
||||
|
||||
|
||||
// vid_nummodes
|
||||
//
|
||||
//added:21-03-98:
|
||||
void VID_Command_NumModes_f (void)
|
||||
{
|
||||
int nummodes;
|
||||
|
||||
nummodes = VID_NumModes ();
|
||||
CONS_Printf ("%d video mode(s) available(s)\n", nummodes);
|
||||
}
|
||||
|
||||
|
||||
// vid_modeinfo <modenum>
|
||||
//
|
||||
void VID_Command_ModeInfo_f (void)
|
||||
{
|
||||
vmode_t *pv;
|
||||
int modenum;
|
||||
|
||||
if (COM_Argc()!=2)
|
||||
modenum = vid.modenum; // describe the current mode
|
||||
else
|
||||
modenum = atoi (COM_Argv(1)); // .. the given mode number
|
||||
|
||||
if (modenum >= VID_NumModes())
|
||||
{
|
||||
CONS_Printf ("No such video mode\n");
|
||||
return;
|
||||
}
|
||||
|
||||
pv = VID_GetModePtr (modenum);
|
||||
|
||||
CONS_Printf ("%s\n", VID_ModeInfo (modenum, NULL));
|
||||
CONS_Printf ("width : %d\n"
|
||||
"height: %d\n"
|
||||
"bytes per scanline: %d\n"
|
||||
"bytes per pixel: %d\n"
|
||||
"numpages: %d\n",
|
||||
pv->width,
|
||||
pv->height,
|
||||
pv->rowbytes,
|
||||
pv->bytesperpixel,
|
||||
pv->numpages );
|
||||
}
|
||||
|
||||
|
||||
// vid_modelist
|
||||
//
|
||||
void VID_Command_ModeList_f (void)
|
||||
{
|
||||
int i, nummodes;
|
||||
const char *pinfo;
|
||||
char *pheader;
|
||||
vmode_t *pv;
|
||||
boolean na;
|
||||
|
||||
na = false;
|
||||
|
||||
nummodes = VID_NumModes ();
|
||||
for (i=0 ; i<nummodes ; i++)
|
||||
{
|
||||
pv = VID_GetModePtr (i);
|
||||
pinfo = VID_ModeInfo (i, &pheader);
|
||||
|
||||
if (i==0 || pv->bytesperpixel==1)
|
||||
CONS_Printf ("%d: %s\n", i, pinfo);
|
||||
else
|
||||
CONS_Printf ("%d: %s (hicolor)\n", i, pinfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// vid_mode <modenum>
|
||||
//
|
||||
void VID_Command_Mode_f (void)
|
||||
{
|
||||
int modenum;
|
||||
|
||||
if (COM_Argc()!=2)
|
||||
{
|
||||
CONS_Printf ("vid_mode <modenum> : set video mode\n");
|
||||
return;
|
||||
}
|
||||
|
||||
modenum = atoi(COM_Argv(1));
|
||||
|
||||
if (modenum >= VID_NumModes())
|
||||
CONS_Printf ("No such video mode\n");
|
||||
else
|
||||
// request vid mode change
|
||||
setmodeneeded = modenum+1;
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief VESA extra modes.
|
||||
|
||||
#include "../doomdef.h"
|
||||
#include "../screen.h"
|
||||
|
||||
|
||||
|
||||
#define MODE_SUPPORTED_IN_HW 0x0001
|
||||
#define COLOR_MODE 0x0008
|
||||
#define GRAPHICS_MODE 0x0010
|
||||
#define VGA_INCOMPATIBLE 0x0020
|
||||
#define LINEAR_FRAME_BUFFER 0x0080
|
||||
#define LINEAR_MODE 0x4000
|
||||
|
||||
#define MAX_VESA_MODES 30 // we'll just take the first 30 if there
|
||||
|
||||
|
||||
// VESA information block structure
|
||||
typedef struct vbeinfoblock_s
|
||||
{
|
||||
UINT8 VESASignature[4];
|
||||
UINT16 VESAVersion;
|
||||
unsigned long OemStringPtr;
|
||||
UINT8 Capabilities[4];
|
||||
unsigned long VideoModePtr;
|
||||
UINT16 TotalMemory;
|
||||
UINT8 OemSoftwareRev[2];
|
||||
UINT8 OemVendorNamePtr[4];
|
||||
UINT8 OemProductNamePtr[4];
|
||||
UINT8 OemProductRevPtr[4];
|
||||
UINT8 Reserved[222];
|
||||
UINT8 OemData[256];
|
||||
} ATTRPACK vbeinfoblock_t;
|
||||
|
||||
|
||||
// VESA information for a specific mode
|
||||
typedef struct vesamodeinfo_s
|
||||
{
|
||||
UINT16 ModeAttributes;
|
||||
UINT8 WinAAttributes;
|
||||
UINT8 WinBAttributes;
|
||||
UINT16 WinGranularity;
|
||||
UINT16 WinSize;
|
||||
UINT16 WinASegment;
|
||||
UINT16 WinBSegment;
|
||||
unsigned long WinFuncPtr;
|
||||
UINT16 BytesPerScanLine;
|
||||
UINT16 XResolution;
|
||||
UINT16 YResolution;
|
||||
UINT8 XCharSize;
|
||||
UINT8 YCharSize;
|
||||
UINT8 NumberOfPlanes;
|
||||
UINT8 BitsPerPixel;
|
||||
UINT8 NumberOfBanks;
|
||||
UINT8 MemoryModel;
|
||||
UINT8 BankSize;
|
||||
UINT8 NumberOfImagePages;
|
||||
UINT8 Reserved_page;
|
||||
UINT8 RedMaskSize;
|
||||
UINT8 RedMaskPos;
|
||||
UINT8 GreenMaskSize;
|
||||
UINT8 GreenMaskPos;
|
||||
UINT8 BlueMaskSize;
|
||||
UINT8 BlueMaskPos;
|
||||
UINT8 ReservedMaskSize;
|
||||
UINT8 ReservedMaskPos;
|
||||
UINT8 DirectColorModeInfo;
|
||||
|
||||
/* VBE 2.0 extensions */
|
||||
unsigned long PhysBasePtr;
|
||||
unsigned long OffScreenMemOffset;
|
||||
UINT16 OffScreenMemSize;
|
||||
|
||||
/* VBE 3.0 extensions */
|
||||
UINT16 LinBytesPerScanLine;
|
||||
UINT8 BnkNumberOfPages;
|
||||
UINT8 LinNumberOfPages;
|
||||
UINT8 LinRedMaskSize;
|
||||
UINT8 LinRedFieldPos;
|
||||
UINT8 LinGreenMaskSize;
|
||||
UINT8 LinGreenFieldPos;
|
||||
UINT8 LinBlueMaskSize;
|
||||
UINT8 LinBlueFieldPos;
|
||||
UINT8 LinRsvdMaskSize;
|
||||
UINT8 LinRsvdFieldPos;
|
||||
unsigned long MaxPixelClock;
|
||||
|
||||
UINT8 Reserved[190];
|
||||
} ATTRPACK vesamodeinfo_t;
|
||||
|
||||
|
||||
// setup standard VGA + VESA modes list, activate the default video mode.
|
||||
void VID_Init (void);
|
||||
Loaded 100 of 327 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user