2
0
mirror of https://github.com/rehlds/rehlds.git synced 2024-12-28 15:45:46 +03:00

GCC support (#339)

* GCC support - could be used via -PuseGcc command line argument.

* Refactoring around __FUNCTION__, change __FUNCTION__ into __func__.

* Refactoring, formatting, small fixes.
This commit is contained in:
Lev 2017-02-11 01:51:22 +05:00 committed by GitHub
parent b0cd67b112
commit 2f64cfc873
76 changed files with 1766 additions and 2083 deletions

3
.gitignore vendored
View File

@ -13,7 +13,10 @@
**/msvc/*.opensdf **/msvc/*.opensdf
**/msvc/*.user **/msvc/*.user
**/msvc/*.suo **/msvc/*.suo
**/msvc/*.db
**/msvc/*.opendb
**/msvc/ipch **/msvc/ipch
**/msvc/.vs
rehlds/version/appversion.h rehlds/version/appversion.h
rehlds/msvc/PublishPath*.txt rehlds/msvc/PublishPath*.txt

View File

@ -58,7 +58,7 @@ There are several software requirements for building rehlds:
<ol> <ol>
<li>Java Development Kit (JDK) 7+ (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)</li> <li>Java Development Kit (JDK) 7+ (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)</li>
<li>For Windows: Visual Studio 2013 and later</li> <li>For Windows: Visual Studio 2013 and later</li>
<li>For Linux: Intel C++ Compiler 13 and later</li> <li>For Linux: Intel C++ Compiler 13 and later or GCC 4.9.2 or later (some earlier versions might work too)</li>
</ol> </ol>
### Checking requirements ### Checking requirements
@ -80,17 +80,27 @@ Help -> About
icc (ICC) 15.0.1 20141023 icc (ICC) 15.0.1 20141023
</pre> </pre>
####GCC
<pre>$ gcc --version
gcc (Debian 4.9.2-10) 4.9.2
</pre>
### Building ### Building
On Windows: On Windows:
<pre>gradlew --max-workers=1 clean buildRelease</pre> <pre>gradlew --max-workers=1 clean buildRelease</pre>
* For faster building without unit tests use this:exclamation: * For faster building without unit tests use this:exclamation:
<pre>gradlew --max-workers=1 clean buildFixes</pre> <pre>gradlew --max-workers=1 clean buildFixes</pre>
On Linux: On Linux (ICC):
<pre>./gradlew --max-workers=1 clean buildRelease</pre> <pre>./gradlew --max-workers=1 clean buildRelease</pre>
* For faster building without unit tests use this:exclamation: * For faster building without unit tests use this:exclamation:
<pre>./gradlew --max-workers=1 clean buildFixes</pre> <pre>./gradlew --max-workers=1 clean buildFixes</pre>
On Linux (GCC):
<pre>./gradlew --max-workers=1 -PuseGcc clean buildRelease</pre>
* For faster building without unit tests use this:exclamation:
<pre>./gradlew --max-workers=1 -PuseGcc clean buildFixes</pre>
Compiled binaries will be placed in the rehlds/build/binaries/ directory Compiled binaries will be placed in the rehlds/build/binaries/ directory
## How can I help the project? ## How can I help the project?

View File

@ -9,40 +9,40 @@ group = 'rehlds'
apply plugin: 'idea' apply plugin: 'idea'
idea { idea {
project { project {
languageLevel = 'JDK_1_7' languageLevel = 'JDK_1_7'
} }
} }
def gitInfo = GitVersioner.versionForDir(project.rootDir) def gitInfo = GitVersioner.versionForDir(project.rootDir)
RehldsVersionInfo versionInfo RehldsVersionInfo versionInfo
if (gitInfo && gitInfo.tag && gitInfo.tag[0] == 'v') { if (gitInfo && gitInfo.tag && gitInfo.tag[0] == 'v') {
def m = gitInfo.tag =~ /^v(\d+)\.(\d+)(\.(\d+))?$/ def m = gitInfo.tag =~ /^v(\d+)\.(\d+)(\.(\d+))?$/
if (!m.find()) { if (!m.find()) {
throw new RuntimeException("Invalid git version tag name ${gitInfo.tag}") throw new RuntimeException("Invalid git version tag name ${gitInfo.tag}")
} }
versionInfo = new RehldsVersionInfo( versionInfo = new RehldsVersionInfo(
majorVersion: m.group(1) as int, majorVersion: m.group(1) as int,
minorVersion: m.group(2) as int, minorVersion: m.group(2) as int,
maintenanceVersion: m.group(4) ? (m.group(4) as int) : null, maintenanceVersion: m.group(4) ? (m.group(4) as int) : null,
localChanges: gitInfo.localChanges, localChanges: gitInfo.localChanges,
commitDate: gitInfo.commitDate, commitDate: gitInfo.commitDate,
commitSHA: gitInfo.commitSHA, commitSHA: gitInfo.commitSHA,
commitURL: gitInfo.commitURL commitURL: gitInfo.commitURL
) )
} else { } else {
versionInfo = new RehldsVersionInfo( versionInfo = new RehldsVersionInfo(
majorVersion: project.majorVersion as int, majorVersion: project.majorVersion as int,
minorVersion: project.minorVersion as int, minorVersion: project.minorVersion as int,
maintenanceVersion: project.maintenanceVersion as int, maintenanceVersion: project.maintenanceVersion as int,
suffix: 'dev', suffix: 'dev',
localChanges: gitInfo ? gitInfo.localChanges : true, localChanges: gitInfo ? gitInfo.localChanges : true,
commitDate: gitInfo ? gitInfo.commitDate : new DateTime(), commitDate: gitInfo ? gitInfo.commitDate : new DateTime(),
commitSHA: gitInfo ? gitInfo.commitSHA : "", commitSHA: gitInfo ? gitInfo.commitSHA : "",
commitURL: gitInfo ? gitInfo.commitURL : "", commitURL: gitInfo ? gitInfo.commitURL : "",
commitCount: gitInfo ? (gitInfo.commitCount as int) : null commitCount: gitInfo ? (gitInfo.commitCount as int) : null
) )
} }
project.ext.rehldsVersionInfo = versionInfo project.ext.rehldsVersionInfo = versionInfo
@ -51,5 +51,5 @@ project.version = versionInfo.asMavenVersion()
apply from: 'publish.gradle' apply from: 'publish.gradle'
task wrapper(type: Wrapper) { task wrapper(type: Wrapper) {
gradleVersion = '2.4' gradleVersion = '2.4'
} }

View File

@ -2,6 +2,7 @@ import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils
import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig
import org.doomedsociety.gradlecpp.toolchain.icc.Icc import org.doomedsociety.gradlecpp.toolchain.icc.Icc
import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin
import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig
import org.gradle.nativeplatform.NativeBinarySpec import org.gradle.nativeplatform.NativeBinarySpec
import org.gradle.nativeplatform.NativeLibrarySpec import org.gradle.nativeplatform.NativeLibrarySpec
import org.gradle.nativeplatform.toolchain.VisualCpp import org.gradle.nativeplatform.toolchain.VisualCpp
@ -9,67 +10,70 @@ import org.gradle.nativeplatform.toolchain.VisualCpp
apply plugin: 'c' apply plugin: 'c'
apply plugin: IccCompilerPlugin apply plugin: IccCompilerPlugin
apply plugin: GccCompilerPlugin
void setupToolchain(NativeBinarySpec b) { void setupToolchain(NativeBinarySpec b) {
def cfg = rootProject.createToolchainConfig(b) def cfg = rootProject.createToolchainConfig(b)
if (cfg instanceof MsvcToolchainConfig) { if (cfg instanceof MsvcToolchainConfig) {
cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig(
enabled: true, enabled: true,
pchHeader: 'bzlib_private.h', pchHeader: 'bzlib_private.h',
pchSourceSet: 'bz2_pch' pchSourceSet: 'bz2_pch'
) )
} }
ToolchainConfigUtils.apply(project, cfg, b) ToolchainConfigUtils.apply(project, cfg, b)
} }
model { model {
buildTypes { buildTypes {
debug debug
release release
} }
platforms { platforms {
x86 { x86 {
architecture "x86" architecture "x86"
} }
} }
toolChains { toolChains {
visualCpp(VisualCpp) { visualCpp(VisualCpp)
} if (project.hasProperty("useGcc")) {
icc(Icc) { gcc(Gcc)
} } else {
} icc(Icc)
}
}
components { components {
bzip2(NativeLibrarySpec) { bzip2(NativeLibrarySpec) {
targetPlatform 'x86' targetPlatform 'x86'
sources { sources {
bz2_main(CSourceSet) { bz2_main(CSourceSet) {
source { source {
srcDir "src" srcDir "src"
include "**/*.c" include "**/*.c"
exclude "precompiled.c" exclude "precompiled.c"
} }
exportedHeaders { exportedHeaders {
srcDir "include" srcDir "include"
} }
} }
bz2_pch(CSourceSet) { bz2_pch(CSourceSet) {
source { source {
srcDir "src" srcDir "src"
include "precompiled.c" include "precompiled.c"
} }
exportedHeaders { exportedHeaders {
srcDir "include" srcDir "include"
} }
} }
} }
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
} }
} }
} }

View File

@ -2,38 +2,42 @@ import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils
import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig
import org.doomedsociety.gradlecpp.toolchain.icc.Icc import org.doomedsociety.gradlecpp.toolchain.icc.Icc
import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin
import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig
import org.gradle.nativeplatform.NativeBinarySpec import org.gradle.nativeplatform.NativeBinarySpec
import org.gradle.nativeplatform.NativeLibrarySpec import org.gradle.nativeplatform.NativeLibrarySpec
apply plugin: 'cpp' apply plugin: 'cpp'
apply plugin: IccCompilerPlugin apply plugin: IccCompilerPlugin
apply plugin: GccCompilerPlugin
void setupToolchain(NativeBinarySpec b) { void setupToolchain(NativeBinarySpec b) {
def cfg = rootProject.createToolchainConfig(b) def cfg = rootProject.createToolchainConfig(b)
ToolchainConfigUtils.apply(project, cfg, b) ToolchainConfigUtils.apply(project, cfg, b)
} }
model { model {
buildTypes { buildTypes {
debug debug
release release
} }
platforms { platforms {
x86 { x86 {
architecture "x86" architecture "x86"
} }
} }
toolChains { toolChains {
visualCpp(VisualCpp) { visualCpp(VisualCpp)
} if (project.hasProperty("useGcc")) {
icc(Icc) { gcc(Gcc)
} } else {
} icc(Icc)
}
}
components { components {
cppunitlite(NativeLibrarySpec) { cppunitlite(NativeLibrarySpec) {
targetPlatform 'x86' targetPlatform 'x86'
@ -51,9 +55,9 @@ model {
} }
binaries.all { NativeBinarySpec b -> binaries.all { NativeBinarySpec b ->
project.setupToolchain(b) project.setupToolchain(b)
} }
} }
} }
} }

View File

@ -8,28 +8,28 @@ sourceCompatibility = '1.7'
targetCompatibility = '1.7' targetCompatibility = '1.7'
repositories { repositories {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
testCompile 'org.codehaus.groovy:groovy-all:2.4.5' testCompile 'org.codehaus.groovy:groovy-all:2.4.5'
testCompile "junit:junit:4.12" testCompile "junit:junit:4.12"
compile project(':flightrec/decoder_api') compile project(':flightrec/decoder_api')
} }
task uberjar(type: Jar, dependsOn: ['check', ':flightrec/decoder_api:build']) { task uberjar(type: Jar, dependsOn: ['check', ':flightrec/decoder_api:build']) {
from files(sourceSets.main.output.classesDir) from files(sourceSets.main.output.classesDir)
from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } } from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } }
exclude('META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.LIST') //exclude all signing stuff exclude('META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.LIST') //exclude all signing stuff
manifest { manifest {
attributes 'Main-Class': 'org.rehlds.flightrec.main.FlightRecorder' attributes 'Main-Class': 'org.rehlds.flightrec.main.FlightRecorder'
attributes 'Implementation-Vendor': 'Sun Microsystems, Inc' attributes 'Implementation-Vendor': 'Sun Microsystems, Inc'
attributes 'Implementation-Title': 'Java Runtime Environment' attributes 'Implementation-Title': 'Java Runtime Environment'
attributes 'Implementation-Version': '1.7.0' attributes 'Implementation-Version': '1.7.0'
} }
} }
tasks.withType(AbstractCompile) { tasks.withType(AbstractCompile) {
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }

View File

@ -8,67 +8,67 @@ sourceCompatibility = '1.7'
targetCompatibility = '1.7' targetCompatibility = '1.7'
repositories { repositories {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
testCompile "junit:junit:4.12" testCompile "junit:junit:4.12"
} }
publishing { publishing {
publications { publications {
maven(MavenPublication) { maven(MavenPublication) {
version project.version version project.version
artifactId 'decoder-api' artifactId 'decoder-api'
artifact jar artifact jar
pom.withXml { pom.withXml {
asNode().children().last() + { asNode().children().last() + {
resolveStrategy = DELEGATE_FIRST resolveStrategy = DELEGATE_FIRST
name 'decoder-api' name 'decoder-api'
description project.description description project.description
//url github //url github
//scm { //scm {
// url "${github}.git" // url "${github}.git"
// connection "scm:git:${github}.git" // connection "scm:git:${github}.git"
//} //}
/* /*
licenses { licenses {
license { license {
name 'The Apache Software License, Version 2.0' name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt' url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo' distribution 'repo'
} }
} }
developers { developers {
developer { developer {
id 'dreamstalker' id 'dreamstalker'
name 'dreamstalker' name 'dreamstalker'
} }
} }
*/ */
} }
} }
} }
} }
} }
publishing { publishing {
repositories { repositories {
maven { maven {
if (project.version.contains('dev')) { if (project.version.contains('dev')) {
url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-dev/" url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-dev/"
} else { } else {
url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/" url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/"
} }
credentials { credentials {
username rootProject.repoCreds.getProperty('username') username rootProject.repoCreds.getProperty('username')
password rootProject.repoCreds.getProperty('password') password rootProject.repoCreds.getProperty('password')
} }
} }
} }
} }
tasks.withType(AbstractCompile) { tasks.withType(AbstractCompile) {
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }

View File

@ -2,154 +2,154 @@ import org.doomedsociety.gradlecpp.GradleCppUtils
import org.apache.commons.io.FilenameUtils import org.apache.commons.io.FilenameUtils
void _copyFileToDir(String from, String to) { void _copyFileToDir(String from, String to) {
def dst = new File(project.file(to), FilenameUtils.getName(from)) def dst = new File(project.file(to), FilenameUtils.getName(from))
GradleCppUtils.copyFile(project.file(from), dst, false) GradleCppUtils.copyFile(project.file(from), dst, false)
} }
void _copyFile(String from, String to) { void _copyFile(String from, String to) {
GradleCppUtils.copyFile(project.file(from), project.file(to), false) GradleCppUtils.copyFile(project.file(from), project.file(to), false)
} }
task publishPrepareFiles { task publishPrepareFiles {
dependsOn ':flightrec/decoder:uberjar' dependsOn ':flightrec/decoder:uberjar'
doLast { doLast {
def pubRootDir = project.file('publish/publishRoot') def pubRootDir = project.file('publish/publishRoot')
if (pubRootDir.exists()) { if (pubRootDir.exists()) {
if (!pubRootDir.deleteDir()) { if (!pubRootDir.deleteDir()) {
throw new RuntimeException("Failed to delete ${pubRootDir}") throw new RuntimeException("Failed to delete ${pubRootDir}")
} }
} }
pubRootDir.mkdirs() pubRootDir.mkdirs()
//bugfixed binaries //bugfixed binaries
project.file('publish/publishRoot/bin/bugfixed').mkdirs() project.file('publish/publishRoot/bin/bugfixed').mkdirs()
_copyFileToDir('publish/releaseRehldsFixes/swds.dll', 'publish/publishRoot/bin/bugfixed/') _copyFileToDir('publish/releaseRehldsFixes/swds.dll', 'publish/publishRoot/bin/bugfixed/')
_copyFileToDir('publish/releaseRehldsFixes/swds.pdb', 'publish/publishRoot/bin/bugfixed/') _copyFileToDir('publish/releaseRehldsFixes/swds.pdb', 'publish/publishRoot/bin/bugfixed/')
_copyFile('publish/releaseRehldsFixes/libengine_i486.so', 'publish/publishRoot/bin/bugfixed/engine_i486.so') _copyFile('publish/releaseRehldsFixes/libengine_i486.so', 'publish/publishRoot/bin/bugfixed/engine_i486.so')
//pure binaries //pure binaries
project.file('publish/publishRoot/bin/pure').mkdirs() project.file('publish/publishRoot/bin/pure').mkdirs()
_copyFileToDir('publish/releaseRehldsNofixes/swds.dll', 'publish/publishRoot/bin/pure/') _copyFileToDir('publish/releaseRehldsNofixes/swds.dll', 'publish/publishRoot/bin/pure/')
_copyFileToDir('publish/releaseRehldsNofixes/swds.pdb', 'publish/publishRoot/bin/pure/') _copyFileToDir('publish/releaseRehldsNofixes/swds.pdb', 'publish/publishRoot/bin/pure/')
_copyFile('publish/releaseRehldsNofixes/libengine_i486.so', 'publish/publishRoot/bin/pure/engine_i486.so') _copyFile('publish/releaseRehldsNofixes/libengine_i486.so', 'publish/publishRoot/bin/pure/engine_i486.so')
//hlsdk //hlsdk
project.file('publish/publishRoot/hlsdk').mkdirs() project.file('publish/publishRoot/hlsdk').mkdirs()
copy { copy {
from 'rehlds/common' from 'rehlds/common'
into 'publish/publishRoot/hlsdk/common' into 'publish/publishRoot/hlsdk/common'
} }
copy { copy {
from 'rehlds/dlls' from 'rehlds/dlls'
into 'publish/publishRoot/hlsdk/dlls' into 'publish/publishRoot/hlsdk/dlls'
} }
copy { copy {
from 'rehlds/pm_shared' from 'rehlds/pm_shared'
into 'publish/publishRoot/hlsdk/pm_shared' into 'publish/publishRoot/hlsdk/pm_shared'
} }
copy { copy {
from 'rehlds/public' from 'rehlds/public'
into 'publish/publishRoot/hlsdk/public' into 'publish/publishRoot/hlsdk/public'
exclude '**/rehlds/*', '**/tier0/*' exclude '**/rehlds/*', '**/tier0/*'
} }
copy { copy {
from 'rehlds/public/rehlds' from 'rehlds/public/rehlds'
into 'publish/publishRoot/hlsdk/engine' into 'publish/publishRoot/hlsdk/engine'
} }
//flightrecorder //flightrecorder
def flightRecJarTask = project(':flightrec/decoder').tasks.getByName('uberjar') def flightRecJarTask = project(':flightrec/decoder').tasks.getByName('uberjar')
println flightRecJarTask println flightRecJarTask
println flightRecJarTask.class.name println flightRecJarTask.class.name
File flightRecJarFile = flightRecJarTask.archivePath File flightRecJarFile = flightRecJarTask.archivePath
project.file('publish/publishRoot/flighrec').mkdirs() project.file('publish/publishRoot/flighrec').mkdirs()
GradleCppUtils.copyFile(flightRecJarFile, project.file('publish/publishRoot/flighrec/decoder.jar'), false) GradleCppUtils.copyFile(flightRecJarFile, project.file('publish/publishRoot/flighrec/decoder.jar'), false)
copy { copy {
from new File(project(':flightrec/decoder').projectDir, 'pub') from new File(project(':flightrec/decoder').projectDir, 'pub')
into 'publish/publishRoot/flighrec' into 'publish/publishRoot/flighrec'
} }
} }
} }
task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') { task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') {
baseName = "rehlds-dist-${project.version}" baseName = "rehlds-dist-${project.version}"
destinationDir file('publish') destinationDir file('publish')
from 'publish/publishRoot' from 'publish/publishRoot'
} }
publishing { publishing {
publications { publications {
maven(MavenPublication) { maven(MavenPublication) {
version project.version version project.version
artifact publishPackage artifact publishPackage
pom.withXml { pom.withXml {
asNode().children().last() + { asNode().children().last() + {
resolveStrategy = DELEGATE_FIRST resolveStrategy = DELEGATE_FIRST
name project.name name project.name
description project.description description project.description
properties { properties {
commitDate project.ext.rehldsVersionInfo.commitDate commitDate project.ext.rehldsVersionInfo.commitDate
commitSHA project.ext.rehldsVersionInfo.commitSHA commitSHA project.ext.rehldsVersionInfo.commitSHA
} }
//url github //url github
//scm { //scm {
// url "${github}.git" // url "${github}.git"
// connection "scm:git:${github}.git" // connection "scm:git:${github}.git"
//} //}
/* /*
licenses { licenses {
license { license {
name 'The Apache Software License, Version 2.0' name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt' url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo' distribution 'repo'
} }
} }
developers { developers {
developer { developer {
id 'dreamstalker' id 'dreamstalker'
name 'dreamstalker' name 'dreamstalker'
} }
} }
*/ */
} }
} }
} }
} }
} }
Properties repoCreds = new Properties() Properties repoCreds = new Properties()
project.ext.repoCreds = repoCreds project.ext.repoCreds = repoCreds
if (file('repo_creds.properties').exists()) { if (file('repo_creds.properties').exists()) {
println 'Loading maven repo credentials' println 'Loading maven repo credentials'
file('repo_creds.properties').withReader('UTF-8', { Reader r -> file('repo_creds.properties').withReader('UTF-8', { Reader r ->
repoCreds.load(r) repoCreds.load(r)
}) })
} }
publishing { publishing {
repositories { repositories {
maven { maven {
if (project.version.contains('dev')) { if (project.version.contains('dev')) {
url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-dev/" url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-dev/"
} else { } else {
url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/" url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/"
} }
credentials { credentials {
username repoCreds.getProperty('username') username repoCreds.getProperty('username')
password repoCreds.getProperty('password') password repoCreds.getProperty('password')
} }
} }
} }
} }
task doPublish { task doPublish {
dependsOn 'publishPackage' dependsOn 'publishPackage'
if (repoCreds.getProperty('username') && repoCreds.getProperty('password')) { if (repoCreds.getProperty('username') && repoCreds.getProperty('password')) {
dependsOn 'publish' dependsOn 'publish'
dependsOn ':flightrec/decoder_api:publish' dependsOn ':flightrec/decoder_api:publish'
} }
} }

View File

@ -23,6 +23,7 @@ import org.apache.commons.io.FilenameUtils
apply plugin: 'cpp' apply plugin: 'cpp'
apply plugin: IccCompilerPlugin apply plugin: IccCompilerPlugin
apply plugin: GccCompilerPlugin
apply plugin: RehldsPlayTestPlugin apply plugin: RehldsPlayTestPlugin
apply plugin: gradlecpp.CppUnitTestPlugin apply plugin: gradlecpp.CppUnitTestPlugin
@ -33,303 +34,313 @@ repositories {
} }
configurations { configurations {
rehlds_tests rehlds_tests
} }
dependencies { dependencies {
rehlds_tests 'rehlds.testdemos:hl-phys-single1:1.1' rehlds_tests 'rehlds.testdemos:hl-phys-single1:1.1'
rehlds_tests 'rehlds.testdemos:crossfire-1-multiplayer-1:1.1' rehlds_tests 'rehlds.testdemos:crossfire-1-multiplayer-1:1.1'
rehlds_tests 'rehlds.testdemos:cstrike-muliplayer-1:1.1' rehlds_tests 'rehlds.testdemos:cstrike-muliplayer-1:1.1'
rehlds_tests 'rehlds.testdemos:shooting-hl-1:1.1' rehlds_tests 'rehlds.testdemos:shooting-hl-1:1.1'
} }
project.ext.dep_bzip2 = project(':dep/bzip2') project.ext.dep_bzip2 = project(':dep/bzip2')
project.ext.dep_cppunitlite = project(':dep/cppunitlite') project.ext.dep_cppunitlite = project(':dep/cppunitlite')
void createIntergrationTestTask(NativeBinarySpec b) { void createIntergrationTestTask(NativeBinarySpec b) {
boolean rehldsFixes = b.flavor.name.contains('rehldsFixes') boolean rehldsFixes = b.flavor.name.contains('rehldsFixes')
if (!(b instanceof SharedLibraryBinarySpec)) return if (!(b instanceof SharedLibraryBinarySpec)) return
if (!GradleCppUtils.windows) return if (!GradleCppUtils.windows) return
if (rehldsFixes) return if (rehldsFixes) return
def libLinkTask = GradleCppUtils.getLinkTask(b) def libLinkTask = GradleCppUtils.getLinkTask(b)
String unitTestTask = b.hasProperty('cppUnitTestTask') ? b.cppUnitTestTask : null String unitTestTask = b.hasProperty('cppUnitTestTask') ? b.cppUnitTestTask : null
def depFiles = [] def depFiles = []
depFiles.addAll(libLinkTask.outputs.files.files) depFiles.addAll(libLinkTask.outputs.files.files)
def demoItgTestTask = project.tasks.create(b.namingScheme.getTaskName('demoItgTest'), RehldsPlayTestTask) def demoItgTestTask = project.tasks.create(b.namingScheme.getTaskName('demoItgTest'), RehldsPlayTestTask)
demoItgTestTask.with { demoItgTestTask.with {
rehldsImageRoot = new File(project.projectDir, '_rehldsTestImg') rehldsImageRoot = new File(project.projectDir, '_rehldsTestImg')
rehldsTestLogs = new File(this.project.buildDir, "_rehldsTestLogs/${b.name}") rehldsTestLogs = new File(this.project.buildDir, "_rehldsTestLogs/${b.name}")
testDemos = project.configurations.rehlds_tests testDemos = project.configurations.rehlds_tests
testFor = b testFor = b
//inputs/outputs for up-to-date check //inputs/outputs for up-to-date check
inputs.files depFiles inputs.files depFiles
inputs.files testDemos.files inputs.files testDemos.files
outputs.dir rehldsTestLogs outputs.dir rehldsTestLogs
//dependencies on library and test executable //dependencies on library and test executable
dependsOn libLinkTask dependsOn libLinkTask
if (unitTestTask) { if (unitTestTask) {
dependsOn unitTestTask dependsOn unitTestTask
} }
postExtractAction { postExtractAction {
def binaryOutFile = GradleCppUtils.getBinaryOutputFile(b) def binaryOutFile = GradleCppUtils.getBinaryOutputFile(b)
GradleCppUtils.copyFile(binaryOutFile, new File(rehldsImageRoot, binaryOutFile.name), true) GradleCppUtils.copyFile(binaryOutFile, new File(rehldsImageRoot, binaryOutFile.name), true)
} }
} }
b.buildTask.dependsOn demoItgTestTask b.buildTask.dependsOn demoItgTestTask
} }
void setupUnitTests(NativeBinarySpec bin) { void setupUnitTests(NativeBinarySpec bin) {
boolean unitTestExecutable = bin.component.name.endsWith('_tests') boolean unitTestExecutable = bin.component.name.endsWith('_tests')
if (!unitTestExecutable) return if (!unitTestExecutable) return
GradleCppUtils.getLinkTask(bin).doLast { GradleCppUtils.getLinkTask(bin).doLast {
String srcPath = '' + projectDir + (GradleCppUtils.windows ? '/lib/steam_api.dll' : '/lib/linux32/libsteam_api.so') String srcPath = '' + projectDir + (GradleCppUtils.windows ? '/lib/steam_api.dll' : '/lib/linux32/libsteam_api.so')
String dstPath = bin.executableFile.parent + (GradleCppUtils.windows ? '/steam_api.dll' : '/libsteam_api.so') String dstPath = bin.executableFile.parent + (GradleCppUtils.windows ? '/steam_api.dll' : '/libsteam_api.so')
GradleCppUtils.copyFile(srcPath, dstPath, true) GradleCppUtils.copyFile(srcPath, dstPath, true)
} }
} }
void postEvaluate(NativeBinarySpec b) { void postEvaluate(NativeBinarySpec b) {
// attach generateAppVersion task to all 'compile source' tasks // attach generateAppVersion task to all 'compile source' tasks
GradleCppUtils.getCompileTasks(b).each { Task t -> GradleCppUtils.getCompileTasks(b).each { Task t ->
t.dependsOn project.generateAppVersion t.dependsOn project.generateAppVersion
} }
setupUnitTests(b) setupUnitTests(b)
createIntergrationTestTask(b) createIntergrationTestTask(b)
} }
void setupToolchain(NativeBinarySpec b) { void setupToolchain(NativeBinarySpec b) {
boolean unitTestExecutable = b.component.name.endsWith('_tests') boolean useGcc = project.hasProperty("useGcc")
boolean swdsLib = b.name.toLowerCase().contains('swds') boolean unitTestExecutable = b.component.name.endsWith('_tests')
boolean rehldsFixes = b.flavor.name.contains('rehldsFixes') boolean swdsLib = b.name.toLowerCase().contains('swds')
boolean rehldsFixes = b.flavor.name.contains('rehldsFixes')
ToolchainConfig cfg = rootProject.createToolchainConfig(b) ToolchainConfig cfg = rootProject.createToolchainConfig(b)
cfg.projectInclude(project, '', '/public/rehlds', '/engine', '/common', '/pm_shared', '/rehlds', '/testsuite', '/hookers', '/public') cfg.projectInclude(project, '', '/public/rehlds', '/engine', '/common', '/pm_shared', '/rehlds', '/testsuite', '/hookers', '/public')
cfg.projectInclude(dep_bzip2, '/include') cfg.projectInclude(dep_bzip2, '/include')
if (unitTestExecutable) { if (unitTestExecutable) {
cfg.projectInclude(dep_cppunitlite, '/include') cfg.projectInclude(dep_cppunitlite, '/include')
b.lib LazyNativeDepSet.create(dep_cppunitlite, 'cppunitlite', b.buildType.name, true) b.lib LazyNativeDepSet.create(dep_cppunitlite, 'cppunitlite', b.buildType.name, true)
} }
b.lib LazyNativeDepSet.create(dep_bzip2, 'bzip2', b.buildType.name, true) b.lib LazyNativeDepSet.create(dep_bzip2, 'bzip2', b.buildType.name, true)
cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'DEDICATED', 'SWDS', 'REHLDS_SELF', 'REHLDS_OPT_PEDANTIC', 'REHLDS_FLIGHT_REC' cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'DEDICATED', 'SWDS', 'REHLDS_SELF', 'REHLDS_OPT_PEDANTIC', 'REHLDS_FLIGHT_REC'
if (cfg instanceof MsvcToolchainConfig) { if (cfg instanceof MsvcToolchainConfig) {
cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig(
enabled: true, enabled: true,
pchHeader: 'precompiled.h', pchHeader: 'precompiled.h',
pchSourceSet: 'rehlds_pch' pchSourceSet: 'rehlds_pch'
) )
cfg.singleDefines('_CRT_SECURE_NO_WARNINGS') cfg.singleDefines('_CRT_SECURE_NO_WARNINGS')
if (!rehldsFixes) { if (!rehldsFixes) {
cfg.compilerOptions.floatingPointModel = FloatingPointModel.PRECISE cfg.compilerOptions.floatingPointModel = FloatingPointModel.PRECISE
cfg.compilerOptions.enhancedInstructionsSet = EnhancedInstructionsSet.DISABLED cfg.compilerOptions.enhancedInstructionsSet = EnhancedInstructionsSet.DISABLED
} else { } else {
cfg.compilerOptions.args '/Oi', '/GF', '/GR-', '/GS-' cfg.compilerOptions.args '/Oi', '/GF', '/GR-', '/GS-'
} }
if (swdsLib) { if (swdsLib) {
cfg.linkerOptions.randomizedBaseAddress = false cfg.linkerOptions.randomizedBaseAddress = false
cfg.linkerOptions.baseAddress = '0x4970000' cfg.linkerOptions.baseAddress = '0x4970000'
} }
cfg.projectLibpath(project, '/lib') cfg.projectLibpath(project, '/lib')
cfg.extraLibs 'steam_api.lib', 'psapi.lib', 'ws2_32.lib', 'kernel32.lib', 'user32.lib', 'advapi32.lib', 'libacof32.lib' cfg.extraLibs 'steam_api.lib', 'psapi.lib', 'ws2_32.lib', 'kernel32.lib', 'user32.lib', 'advapi32.lib', 'libacof32.lib'
} else if (cfg instanceof GccToolchainConfig) { } else if (cfg instanceof GccToolchainConfig) {
cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions( if (!useGcc) {
enabled: true, cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions(
pchSourceSet: 'rehlds_pch' enabled: true,
) pchSourceSet: 'rehlds_pch'
cfg.compilerOptions.languageStandard = 'c++0x' )
cfg.defines([ }
'_stricmp': 'strcasecmp', cfg.compilerOptions.languageStandard = 'c++0x'
'_strnicmp': 'strncasecmp', cfg.defines([
'_strdup': 'strdup', '_stricmp': 'strcasecmp',
'_unlink': 'unlink', '_strnicmp': 'strncasecmp',
'_vsnprintf': 'vsnprintf', '_strdup': 'strdup',
]) '_unlink': 'unlink',
cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-fno-rtti' '_vsnprintf': 'vsnprintf',
cfg.projectLibpath(project, '/lib/linux32') ])
cfg.extraLibs 'rt', 'dl', 'm', 'steam_api', 'aelf32' if (useGcc) {
} // MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
cfg.compilerOptions.args '-march=sandybridge', '-Wno-write-strings'
} else {
cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-fno-rtti'
}
cfg.projectLibpath(project, '/lib/linux32')
cfg.extraLibs 'rt', 'dl', 'm', 'steam_api', 'aelf32'
}
if (!unitTestExecutable && !swdsLib) { if (!unitTestExecutable && !swdsLib) {
cfg.singleDefines 'HOOK_ENGINE' cfg.singleDefines 'HOOK_ENGINE'
} }
if (unitTestExecutable) { if (unitTestExecutable) {
cfg.singleDefines 'REHLDS_UNIT_TESTS' cfg.singleDefines 'REHLDS_UNIT_TESTS'
} }
if (rehldsFixes) { if (rehldsFixes) {
cfg.singleDefines 'REHLDS_FIXES', 'REHLDS_CHECKS' cfg.singleDefines 'REHLDS_FIXES', 'REHLDS_CHECKS'
} }
ToolchainConfigUtils.apply(project, cfg, b) ToolchainConfigUtils.apply(project, cfg, b)
GradleCppUtils.onTasksCreated(project, 'postEvaluate', { GradleCppUtils.onTasksCreated(project, 'postEvaluate', {
postEvaluate(b) postEvaluate(b)
}) })
} }
class RehldsSrc { class RehldsSrc {
static void rehlds_src(def h) { static void rehlds_src(def h) {
h.rehlds_src(CppSourceSet) { h.rehlds_src(CppSourceSet) {
source { source {
srcDirs "engine", "rehlds", "public", "version" srcDirs "engine", "rehlds", "public", "version"
if (GradleCppUtils.windows) srcDirs "testsuite" if (GradleCppUtils.windows) srcDirs "testsuite"
include "**/*.cpp" include "**/*.cpp"
exclude "precompiled.cpp" exclude "precompiled.cpp"
exclude GradleCppUtils.windows ? "tier0/platform_linux.cpp" : "tier0/platform_win32.cpp" exclude GradleCppUtils.windows ? "tier0/platform_linux.cpp" : "tier0/platform_win32.cpp"
exclude "interface.cpp", "rehlds/crc32c.cpp", "rehlds/sys_shared.cpp" exclude "interface.cpp", "rehlds/crc32c.cpp", "rehlds/sys_shared.cpp"
} }
source { source {
srcDirs "hookers" srcDirs "hookers"
include "**/*.cpp" include "**/*.cpp"
exclude "6132_hooker.cpp", "hooker.cpp", "main.cpp", "main_swds.cpp" exclude "6132_hooker.cpp", "hooker.cpp", "main.cpp", "main_swds.cpp"
if (!GradleCppUtils.windows) exclude "rehlds_debug.cpp" if (!GradleCppUtils.windows) exclude "rehlds_debug.cpp"
} }
} }
} }
static void rehlds_pch(def h) { static void rehlds_pch(def h) {
h.rehlds_pch(CppSourceSet) { h.rehlds_pch(CppSourceSet) {
source { source {
srcDirs "rehlds" srcDirs "rehlds"
include "precompiled.cpp" include "precompiled.cpp"
} }
} }
} }
static void rehlds_hooker_src(def h) { static void rehlds_hooker_src(def h) {
h.rehlds_hooker_src(CppSourceSet) { h.rehlds_hooker_src(CppSourceSet) {
source { source {
srcDirs "hookers" srcDirs "hookers"
include "6132_hooker.cpp", "hooker.cpp" include "6132_hooker.cpp", "hooker.cpp"
} }
} }
} }
static void rehlds_hooker_main_src(def h) { static void rehlds_hooker_main_src(def h) {
h.rehlds_hooker_main_src(CppSourceSet) { h.rehlds_hooker_main_src(CppSourceSet) {
source { source {
srcDirs "hookers" srcDirs "hookers"
include "main.cpp" include "main.cpp"
} }
} }
} }
static void rehlds_swds_main_src(def h) { static void rehlds_swds_main_src(def h) {
h.rehlds_swds_main_src(CppSourceSet) { h.rehlds_swds_main_src(CppSourceSet) {
source { source {
srcDirs "hookers" srcDirs "hookers"
include "main_swds.cpp" include "main_swds.cpp"
} }
} }
} }
static void rehlds_tests_src(def h) { static void rehlds_tests_src(def h) {
h.rehlds_tests_src(CppSourceSet) { h.rehlds_tests_src(CppSourceSet) {
source { source {
srcDir "unittests" srcDir "unittests"
include "**/*.cpp" include "**/*.cpp"
} }
} }
} }
} }
model { model {
buildTypes { buildTypes {
debug debug
release release
} }
platforms { platforms {
x86 { x86 {
architecture "x86" architecture "x86"
} }
} }
toolChains { toolChains {
visualCpp(VisualCpp) { visualCpp(VisualCpp)
} if (project.hasProperty("useGcc")) {
icc(Icc) { gcc(Gcc)
} } else {
} icc(Icc)
}
}
flavors { flavors {
rehldsNofixes rehldsNofixes
rehldsFixes rehldsFixes
} }
components { components {
rehlds_hooker_engine(NativeLibrarySpec) { rehlds_hooker_engine(NativeLibrarySpec) {
targetPlatform 'x86' targetPlatform 'x86'
baseName 'FileSystem_Stdio' baseName 'FileSystem_Stdio'
sources { sources {
RehldsSrc.rehlds_pch(it) RehldsSrc.rehlds_pch(it)
RehldsSrc.rehlds_src(it) RehldsSrc.rehlds_src(it)
RehldsSrc.rehlds_hooker_src(it) RehldsSrc.rehlds_hooker_src(it)
RehldsSrc.rehlds_hooker_main_src(it) RehldsSrc.rehlds_hooker_main_src(it)
} }
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
} }
rehlds_swds_engine(NativeLibrarySpec) { rehlds_swds_engine(NativeLibrarySpec) {
targetPlatform 'x86' targetPlatform 'x86'
baseName GradleCppUtils.windows ? 'swds' : 'engine_i486' baseName GradleCppUtils.windows ? 'swds' : 'engine_i486'
sources { sources {
RehldsSrc.rehlds_pch(it) RehldsSrc.rehlds_pch(it)
RehldsSrc.rehlds_src(it) RehldsSrc.rehlds_src(it)
RehldsSrc.rehlds_swds_main_src(it) RehldsSrc.rehlds_swds_main_src(it)
} }
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
} }
rehlds_hooker_engine_tests(NativeExecutableSpec) { rehlds_hooker_engine_tests(NativeExecutableSpec) {
targetPlatform 'x86' targetPlatform 'x86'
sources { sources {
RehldsSrc.rehlds_pch(it) RehldsSrc.rehlds_pch(it)
RehldsSrc.rehlds_src(it) RehldsSrc.rehlds_src(it)
RehldsSrc.rehlds_tests_src(it) RehldsSrc.rehlds_tests_src(it)
} }
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
} }
rehlds_swds_engine_tests(NativeExecutableSpec) { rehlds_swds_engine_tests(NativeExecutableSpec) {
targetPlatform 'x86' targetPlatform 'x86'
sources { sources {
RehldsSrc.rehlds_pch(it) RehldsSrc.rehlds_pch(it)
RehldsSrc.rehlds_src(it) RehldsSrc.rehlds_src(it)
RehldsSrc.rehlds_tests_src(it) RehldsSrc.rehlds_tests_src(it)
} }
binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } binaries.all { NativeBinarySpec b -> project.setupToolchain(b) }
} }
} }
} }
task buildRelease { task buildRelease {
dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib -> dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib ->
blib.buildable && blib.buildType.name == 'release' && !blib.name.contains('Rehlds_hooker_engine') blib.buildable && blib.buildType.name == 'release' && !blib.name.contains('Rehlds_hooker_engine')
} }
} }
task buildFixes { task buildFixes {
@ -351,21 +362,21 @@ gradle.taskGraph.whenReady { graph ->
} }
task prepareDevEnvTests { task prepareDevEnvTests {
def rehldsTests = new File(project.projectDir, '_dev/testDemos') def rehldsTests = new File(project.projectDir, '_dev/testDemos')
inputs.files configurations.rehlds_tests.files inputs.files configurations.rehlds_tests.files
outputs.dir rehldsTests outputs.dir rehldsTests
doLast { doLast {
rehldsTests.mkdirs() rehldsTests.mkdirs()
configurations.rehlds_tests.files.each { File f -> configurations.rehlds_tests.files.each { File f ->
def t = zipTree(f) def t = zipTree(f)
copy { copy {
into new File(rehldsTests, FilenameUtils.getBaseName(f.absolutePath)) into new File(rehldsTests, FilenameUtils.getBaseName(f.absolutePath))
from t from t
} }
} }
} }
} }
task prepareDevEnvEngine << { task prepareDevEnvEngine << {
@ -378,40 +389,40 @@ task prepareDevEnvEngine << {
} }
task prepareDevEnv { task prepareDevEnv {
dependsOn prepareDevEnvEngine, prepareDevEnvTests dependsOn prepareDevEnvEngine, prepareDevEnvTests
} }
tasks.clean.doLast { tasks.clean.doLast {
project.file('version/appversion.h').delete() project.file('version/appversion.h').delete()
} }
task generateAppVersion { task generateAppVersion {
RehldsVersionInfo verInfo = (RehldsVersionInfo) rootProject.rehldsVersionInfo RehldsVersionInfo verInfo = (RehldsVersionInfo) rootProject.rehldsVersionInfo
def tplFile = project.file('version/appversion.vm') def tplFile = project.file('version/appversion.vm')
def renderedFile = project.file('version/appversion.h') def renderedFile = project.file('version/appversion.h')
// check to up-to-date // check to up-to-date
inputs.file tplFile inputs.file tplFile
inputs.file project.file('gradle.properties') inputs.file project.file('gradle.properties')
outputs.file renderedFile outputs.file renderedFile
// this will ensure that this task is redone when the versions change // this will ensure that this task is redone when the versions change
inputs.property('version', rootProject.version) inputs.property('version', rootProject.version)
inputs.property('commitDate', verInfo.asCommitDate()) inputs.property('commitDate', verInfo.asCommitDate())
println "##teamcity[buildNumber '" + verInfo.asMavenVersion(false) + "']"; println "##teamcity[buildNumber '" + verInfo.asMavenVersion(false) + "']";
doLast { doLast {
def templateCtx = [ def templateCtx = [
verInfo : verInfo verInfo : verInfo
] ]
def content = VelocityUtils.renderTemplate(tplFile, templateCtx) def content = VelocityUtils.renderTemplate(tplFile, templateCtx)
renderedFile.delete() renderedFile.delete()
renderedFile.write(content, 'utf-8') renderedFile.write(content, 'utf-8')
println 'The current ReHLDS maven version is ' + rootProject.version + ', url: (' + verInfo.commitURL + '' + verInfo.commitSHA + ')'; println 'The current ReHLDS maven version is ' + rootProject.version + ', url: (' + verInfo.commitURL + '' + verInfo.commitSHA + ')';
} }
} }

View File

@ -65,32 +65,31 @@ typedef union DLONG_u
#endif #endif
template <typename T> template <typename T>
inline T min(T a, T b) { inline T min(T a, T b)
{
return (a < b) ? a : b; return (a < b) ? a : b;
} }
template <typename T> template <typename T>
inline T max(T a, T b) { inline T max(T a, T b)
{
return (a < b) ? b : a; return (a < b) ? b : a;
} }
template <typename T> template <typename T>
inline T clamp(T a, T min, T max) { inline T clamp(T a, T min, T max)
{
return (a > max) ? max : (a < min) ? min : a; return (a > max) ? max : (a < min) ? min : a;
} }
template <typename T> template <typename T>
inline T bswap(T s) { inline T bswap(T s)
switch (sizeof(T)) { {
#ifdef _WIN32 switch (sizeof(T))
case 2: {auto res = _byteswap_ushort(*(uint16 *)&s); return *(T *)&res;} {
case 4: {auto res = _byteswap_ulong(*(uint32 *)(&s)); return *(T *)&res;} case 2: {auto res = __builtin_bswap16(*(uint16 *)&s); return *(T *)&res; }
case 8: {auto res = _byteswap_uint64(*(uint64 *)&s); return *(T *)&res;} case 4: {auto res = __builtin_bswap32(*(uint32 *)&s); return *(T *)&res; }
#else case 8: {auto res = __builtin_bswap64(*(uint64 *)&s); return *(T *)&res; }
case 2: {auto res = _bswap16(*(uint16 *)&s); return *(T *)&res;}
case 4: {auto res = _bswap(*(uint32 *)&s); return *(T *)&res;}
case 8: {auto res = _bswap64(*(uint64 *)&s); return *(T *)&res;}
#endif
default: return s; default: return s;
} }
} }

View File

@ -52,7 +52,7 @@ cvar_t console;
#endif //HOOK_ENGINE #endif //HOOK_ENGINE
void CL_RecordHUDCommand(char *cmdname) { } void CL_RecordHUDCommand(const char *cmdname) { }
void R_DecalRemoveAll(int textureIndex) { } void R_DecalRemoveAll(int textureIndex) { }
void CL_CheckForResend(void) { } void CL_CheckForResend(void) { }
qboolean CL_CheckFile(sizebuf_t *msg, char *filename) { return 1; } qboolean CL_CheckFile(sizebuf_t *msg, char *filename) { return 1; }

View File

@ -289,7 +289,7 @@ extern cvar_t cl_name;
extern cvar_t rate_; extern cvar_t rate_;
extern cvar_t console; extern cvar_t console;
void CL_RecordHUDCommand(char *cmdname); void CL_RecordHUDCommand(const char *cmdname);
void R_DecalRemoveAll(int textureIndex); void R_DecalRemoveAll(int textureIndex);
void CL_CheckForResend(void); void CL_CheckForResend(void);
qboolean CL_CheckFile(sizebuf_t *msg, char *filename); qboolean CL_CheckFile(sizebuf_t *msg, char *filename);

View File

@ -63,7 +63,7 @@ void Cbuf_AddText(char *text)
if (cmd_text.cursize + len >= cmd_text.maxsize) if (cmd_text.cursize + len >= cmd_text.maxsize)
{ {
Con_Printf(__FUNCTION__ ": overflow\n"); Con_Printf("%s: overflow\n", __func__);
return; return;
} }
@ -81,7 +81,7 @@ void Cbuf_InsertText(char *text)
if (cmd_text.cursize + addLen >= cmd_text.maxsize) if (cmd_text.cursize + addLen >= cmd_text.maxsize)
{ {
Con_Printf(__FUNCTION__ ": overflow\n"); Con_Printf("%s: overflow\n", __func__);
return; return;
} }
@ -119,7 +119,7 @@ void Cbuf_InsertTextLines(char *text)
if (cmd_text.cursize + addLen + 2 >= cmd_text.maxsize) if (cmd_text.cursize + addLen + 2 >= cmd_text.maxsize)
{ {
Con_Printf(__FUNCTION__ ": overflow\n"); Con_Printf("%s: overflow\n", __func__);
return; return;
} }
@ -417,7 +417,7 @@ void Cmd_Echo_f(void)
Con_Printf("\n"); Con_Printf("\n");
} }
char *CopyString(char *in) char *CopyString(const char *in)
{ {
char *out = (char *)Z_Malloc(Q_strlen(in) + 1); char *out = (char *)Z_Malloc(Q_strlen(in) + 1);
Q_strcpy(out, in); Q_strcpy(out, in);
@ -652,7 +652,7 @@ void EXT_FUNC Cmd_TokenizeString(char *text)
} }
} }
NOXREF cmd_function_t *Cmd_FindCmd(char *cmd_name) NOXREF cmd_function_t *Cmd_FindCmd(const char *cmd_name)
{ {
NOXREFCHECK; NOXREFCHECK;
@ -669,7 +669,7 @@ NOXREF cmd_function_t *Cmd_FindCmd(char *cmd_name)
return NULL; return NULL;
} }
cmd_function_t *Cmd_FindCmdPrev(char *cmd_name) cmd_function_t *Cmd_FindCmdPrev(const char *cmd_name)
{ {
cmd_function_t *cmd = NULL; cmd_function_t *cmd = NULL;
@ -715,26 +715,26 @@ void Cmd_InsertCommand(cmd_function_t *cmd)
} }
// Use this for engine inside call only, not from user code, because it doesn't alloc string for the name. // Use this for engine inside call only, not from user code, because it doesn't alloc string for the name.
void Cmd_AddCommand(char *cmd_name, xcommand_t function) void Cmd_AddCommand(const char *cmd_name, xcommand_t function)
{ {
cmd_function_t *cmd; cmd_function_t *cmd;
if (host_initialized) if (host_initialized)
{ {
Sys_Error(__FUNCTION__ " after host_initialized"); Sys_Error("%s: called after host_initialized", __func__);
} }
// Check in variables list // Check in variables list
if (Cvar_FindVar(cmd_name) != NULL) if (Cvar_FindVar(cmd_name) != NULL)
{ {
Con_Printf(__FUNCTION__ ": \"%s\" already defined as a var\n", cmd_name); Con_Printf("%s: \"%s\" already defined as a var\n", __func__, cmd_name);
return; return;
} }
// Check if this command is already defined // Check if this command is already defined
if (Cmd_Exists(cmd_name)) if (Cmd_Exists(cmd_name))
{ {
Con_Printf(__FUNCTION__ ": \"%s\" already defined\n", cmd_name); Con_Printf("%s: \"%s\" already defined\n", __func__, cmd_name);
return; return;
} }
@ -748,21 +748,21 @@ void Cmd_AddCommand(char *cmd_name, xcommand_t function)
} }
// Use this for call from user code, because it alloc string for the name. // Use this for call from user code, because it alloc string for the name.
void Cmd_AddMallocCommand(char *cmd_name, xcommand_t function, int flag) void Cmd_AddMallocCommand(const char *cmd_name, xcommand_t function, int flag)
{ {
cmd_function_t *cmd; cmd_function_t *cmd;
// Check in variables list // Check in variables list
if (Cvar_FindVar(cmd_name) != NULL) if (Cvar_FindVar(cmd_name) != NULL)
{ {
Con_Printf(__FUNCTION__ ": \"%s\" already defined as a var\n", cmd_name); Con_Printf("%s: \"%s\" already defined as a var\n", __func__, cmd_name);
return; return;
} }
// Check if this command is already defined // Check if this command is already defined
if (Cmd_Exists(cmd_name)) if (Cmd_Exists(cmd_name))
{ {
Con_Printf(__FUNCTION__ ": \"%s\" already defined\n", cmd_name); Con_Printf("%s: \"%s\" already defined\n", __func__, cmd_name);
return; return;
} }
@ -775,26 +775,26 @@ void Cmd_AddMallocCommand(char *cmd_name, xcommand_t function, int flag)
Cmd_InsertCommand(cmd); Cmd_InsertCommand(cmd);
} }
NOXREF void Cmd_AddHUDCommand(char *cmd_name, xcommand_t function) NOXREF void Cmd_AddHUDCommand(const char *cmd_name, xcommand_t function)
{ {
NOXREFCHECK; NOXREFCHECK;
Cmd_AddMallocCommand(cmd_name, function, FCMD_HUD_COMMAND); Cmd_AddMallocCommand(cmd_name, function, FCMD_HUD_COMMAND);
} }
NOXREF void Cmd_AddWrapperCommand(char *cmd_name, xcommand_t function) NOXREF void Cmd_AddWrapperCommand(const char *cmd_name, xcommand_t function)
{ {
NOXREFCHECK; NOXREFCHECK;
Cmd_AddMallocCommand(cmd_name, function, FCMD_WRAPPER_COMMAND); Cmd_AddMallocCommand(cmd_name, function, FCMD_WRAPPER_COMMAND);
} }
void EXT_FUNC Cmd_AddGameCommand(char *cmd_name, xcommand_t function) void EXT_FUNC Cmd_AddGameCommand(const char *cmd_name, xcommand_t function)
{ {
Cmd_AddMallocCommand(cmd_name, function, FCMD_GAME_COMMAND); Cmd_AddMallocCommand(cmd_name, function, FCMD_GAME_COMMAND);
} }
void EXT_FUNC Cmd_RemoveCmd(char *cmd_name) void EXT_FUNC Cmd_RemoveCmd(const char *cmd_name)
{ {
auto prev = Cmd_FindCmdPrev(cmd_name); auto prev = Cmd_FindCmdPrev(cmd_name);
@ -802,7 +802,7 @@ void EXT_FUNC Cmd_RemoveCmd(char *cmd_name)
auto cmd = prev->next; auto cmd = prev->next;
prev->next = cmd->next; prev->next = cmd->next;
Z_Free(cmd->name); Z_Free((void*)cmd->name);
Mem_Free(cmd); Mem_Free(cmd);
} }
} }
@ -818,7 +818,7 @@ void Cmd_RemoveMallocedCmds(int flag)
if (c->flags & flag) if (c->flags & flag)
{ {
*p = c->next; *p = c->next;
Z_Free(c->name); Z_Free((void*)c->name);
Mem_Free(c); Mem_Free(c);
c = *p; c = *p;
continue; continue;
@ -862,7 +862,7 @@ qboolean Cmd_Exists(const char *cmd_name)
return FALSE; return FALSE;
} }
NOXREF char *Cmd_CompleteCommand(char *search, int forward) NOXREF const char *Cmd_CompleteCommand(char *search, int forward)
{ {
NOXREFCHECK; NOXREFCHECK;
@ -1007,10 +1007,12 @@ qboolean Cmd_ForwardToServerInternal(sizebuf_t *pBuf)
return FALSE; return FALSE;
} }
char tempData[4096]; char tempData[4096], buffername[64];
sizebuf_t tempBuf; sizebuf_t tempBuf;
tempBuf.buffername = __FUNCTION__ "::tempBuf"; Q_sprintf(buffername, "%s::%s", __func__, nameof_variable(tempBuf));
tempBuf.buffername = buffername;
tempBuf.data = (byte *)tempData; tempBuf.data = (byte *)tempData;
tempBuf.maxsize = 4096; tempBuf.maxsize = 4096;
tempBuf.cursize = 0; tempBuf.cursize = 0;
@ -1061,7 +1063,7 @@ NOXREF int Cmd_CheckParm(char *parm)
if (!parm) if (!parm)
{ {
Sys_Error(__FUNCTION__ ": NULL"); Sys_Error("%s: NULL", __func__);
} }
int c = Cmd_Argc(); int c = Cmd_Argc();

View File

@ -93,7 +93,7 @@ void Cbuf_Execute(void);
void Cmd_StuffCmds_f(void); void Cmd_StuffCmds_f(void);
void Cmd_Exec_f(void); void Cmd_Exec_f(void);
void Cmd_Echo_f(void); void Cmd_Echo_f(void);
char *CopyString(char *in); char *CopyString(const char *in);
void Cmd_Alias_f(void); void Cmd_Alias_f(void);
struct cmd_function_s *Cmd_GetFirstCmd(void); struct cmd_function_s *Cmd_GetFirstCmd(void);
void Cmd_Init(void); void Cmd_Init(void);
@ -102,20 +102,20 @@ int Cmd_Argc(void);
const char *Cmd_Argv(int arg); const char *Cmd_Argv(int arg);
const char *Cmd_Args(void); const char *Cmd_Args(void);
void Cmd_TokenizeString(char *text); void Cmd_TokenizeString(char *text);
NOXREF cmd_function_t *Cmd_FindCmd(char *cmd_name); NOXREF cmd_function_t *Cmd_FindCmd(const char *cmd_name);
cmd_function_t *Cmd_FindCmdPrev(char *cmd_name); cmd_function_t *Cmd_FindCmdPrev(const char *cmd_name);
void Cmd_AddCommand(char *cmd_name, xcommand_t function); void Cmd_AddCommand(const char *cmd_name, xcommand_t function);
void Cmd_AddMallocCommand(char *cmd_name, xcommand_t function, int flag); void Cmd_AddMallocCommand(const char *cmd_name, xcommand_t function, int flag);
NOXREF void Cmd_AddHUDCommand(char *cmd_name, xcommand_t function); NOXREF void Cmd_AddHUDCommand(const char *cmd_name, xcommand_t function);
NOXREF void Cmd_AddWrapperCommand(char *cmd_name, xcommand_t function); NOXREF void Cmd_AddWrapperCommand(const char *cmd_name, xcommand_t function);
void Cmd_AddGameCommand(char *cmd_name, xcommand_t function); void Cmd_AddGameCommand(const char *cmd_name, xcommand_t function);
void Cmd_RemoveCmd(char *cmd_name); void Cmd_RemoveCmd(const char *cmd_name);
void Cmd_RemoveMallocedCmds(int flag); void Cmd_RemoveMallocedCmds(int flag);
NOXREF void Cmd_RemoveHudCmds(void); NOXREF void Cmd_RemoveHudCmds(void);
void Cmd_RemoveGameCmds(void); void Cmd_RemoveGameCmds(void);
void Cmd_RemoveWrapperCmds(void); void Cmd_RemoveWrapperCmds(void);
qboolean Cmd_Exists(const char *cmd_name); qboolean Cmd_Exists(const char *cmd_name);
NOXREF char *Cmd_CompleteCommand(char *search, int forward); NOXREF const char *Cmd_CompleteCommand(char *search, int forward);
void Cmd_ExecuteString(char *text, cmd_source_t src); void Cmd_ExecuteString(char *text, cmd_source_t src);
qboolean Cmd_ForwardToServerInternal(sizebuf_t *pBuf); qboolean Cmd_ForwardToServerInternal(sizebuf_t *pBuf);
void Cmd_ForwardToServer(void); void Cmd_ForwardToServer(void);

View File

@ -54,7 +54,7 @@ unsigned char *Mod_DecompressVis(unsigned char *in, model_t *model)
if (row < 0 || row > MODEL_MAX_PVS) if (row < 0 || row > MODEL_MAX_PVS)
{ {
Sys_Error(__FUNCTION__ ": oversized model->numleafs: %i", model->numleafs); Sys_Error("%s: oversized model->numleafs: %i", __func__, model->numleafs);
} }
CM_DecompressPVS(in, decompressed, row); CM_DecompressPVS(in, decompressed, row);

View File

@ -651,7 +651,7 @@ void MSG_WriteBitAngle(float fAngle, int numbits)
{ {
if (numbits >= 32) if (numbits >= 32)
{ {
Sys_Error(__FUNCTION__ ": Can't write bit angle with 32 bits precision\n"); Sys_Error("%s: Can't write bit angle with 32 bits precision\n", __func__);
} }
uint32 shift = (1 << numbits); uint32 shift = (1 << numbits);
@ -759,7 +759,7 @@ uint32 MSG_ReadBits(int numbits)
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
if (numbits > 32) { if (numbits > 32) {
Sys_Error(__FUNCTION__ ": invalid numbits %d\n", numbits); Sys_Error("%s: invalid numbits %d\n", __func__, numbits);
} }
#endif // REHLDS_FIXES #endif // REHLDS_FIXES
@ -1243,7 +1243,7 @@ void *EXT_FUNC SZ_GetSpace(sizebuf_t *buf, int length)
if (length < 0) if (length < 0)
{ {
Sys_Error(__FUNCTION__ ": %i negative length on %s", length, buffername); Sys_Error("%s: %i negative length on %s", __func__, length, buffername);
} }
if (buf->cursize + length > buf->maxsize) if (buf->cursize + length > buf->maxsize)
@ -1253,32 +1253,32 @@ void *EXT_FUNC SZ_GetSpace(sizebuf_t *buf, int length)
{ {
if (!buf->maxsize) if (!buf->maxsize)
{ {
Sys_Error(__FUNCTION__ ": tried to write to an uninitialized sizebuf_t: %s", buffername); Sys_Error("%s: tried to write to an uninitialized sizebuf_t: %s", __func__, buffername);
} }
else if (length > buf->maxsize) else if (length > buf->maxsize)
{ {
Sys_Error(__FUNCTION__ ": %i is > full buffer size on %s", length, buffername); Sys_Error("%s: %i is > full buffer size on %s", __func__, length, buffername);
} }
else else
{ {
Sys_Error(__FUNCTION__ ": overflow without FSB_ALLOWOVERFLOW set on %s", buffername); Sys_Error("%s: overflow without FSB_ALLOWOVERFLOW set on %s", __func__, buffername);
} }
} }
if (length > buf->maxsize) if (length > buf->maxsize)
{ {
Con_DPrintf(__FUNCTION__ ": %i is > full buffer size on %s, ignoring", length, buffername); Con_DPrintf("%s: %i is > full buffer size on %s, ignoring", __func__, length, buffername);
} }
#else // REHLDS_FIXES #else // REHLDS_FIXES
if (!(buf->flags & SIZEBUF_ALLOW_OVERFLOW)) if (!(buf->flags & SIZEBUF_ALLOW_OVERFLOW))
{ {
if (!buf->maxsize) if (!buf->maxsize)
{ {
Sys_Error(__FUNCTION__ ": Tried to write to an uninitialized sizebuf_t: %s", buffername); Sys_Error("%s: Tried to write to an uninitialized sizebuf_t: %s", __func__, buffername);
} }
else else
{ {
Sys_Error(__FUNCTION__ ": overflow without FSB_ALLOWOVERFLOW set on %s", buffername); Sys_Error("%s: overflow without FSB_ALLOWOVERFLOW set on %s", __func__, buffername);
} }
} }
@ -1286,14 +1286,14 @@ void *EXT_FUNC SZ_GetSpace(sizebuf_t *buf, int length)
{ {
if (!(buf->flags & SIZEBUF_ALLOW_OVERFLOW)) if (!(buf->flags & SIZEBUF_ALLOW_OVERFLOW))
{ {
Sys_Error(__FUNCTION__ ": %i is > full buffer size on %s", length, buffername); Sys_Error("%s: %i is > full buffer size on %s", __func__, length, buffername);
} }
Con_DPrintf(__FUNCTION__ ": %i is > full buffer size on %s, ignoring", length, buffername); Con_DPrintf("%s: %i is > full buffer size on %s, ignoring", __func__, length, buffername);
} }
#endif // REHLDS_FIXES #endif // REHLDS_FIXES
Con_Printf(__FUNCTION__ ": overflow on %s\n", buffername); Con_Printf("%s: overflow on %s\n", __func__, buffername);
SZ_Clear(buf); SZ_Clear(buf);
buf->flags |= SIZEBUF_OVERFLOWED; buf->flags |= SIZEBUF_OVERFLOWED;
@ -1707,7 +1707,7 @@ int COM_TokenWaiting(char *buffer)
return 0; return 0;
} }
int COM_CheckParm(char *parm) int COM_CheckParm(const char *parm)
{ {
int i; int i;
@ -1874,13 +1874,13 @@ NOXREF void COM_WriteFile(char *filename, void *data, int len)
if (fp) if (fp)
{ {
Sys_Printf(__FUNCTION__ ": %s\n", path); Sys_Printf("%s: %s\n", __func__, path);
FS_Write(data, len, 1, fp); FS_Write(data, len, 1, fp);
FS_Close(fp); FS_Close(fp);
} }
else else
{ {
Sys_Printf(__FUNCTION__ ": failed on %s\n", path); Sys_Printf("%s: failed on %s\n", __func__, path);
} }
} }
@ -2050,7 +2050,7 @@ unsigned char* EXT_FUNC COM_LoadFile(const char *path, int usehunk, int *pLength
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
FS_Close(hFile); FS_Close(hFile);
#endif #endif
Sys_Error(__FUNCTION__ ": bad usehunk"); Sys_Error("%s: bad usehunk", __func__);
} }
if (!buf) if (!buf)
@ -2058,7 +2058,7 @@ unsigned char* EXT_FUNC COM_LoadFile(const char *path, int usehunk, int *pLength
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
FS_Close(hFile); FS_Close(hFile);
#endif #endif
Sys_Error(__FUNCTION__ ": not enough space for %s", path); Sys_Error("%s: not enough space for %s", __func__, path);
} }
FS_Read(buf, len, 1, hFile); FS_Read(buf, len, 1, hFile);
@ -2129,7 +2129,7 @@ NOXREF unsigned char *COM_LoadFileLimit(char *path, int pos, int cbmax, int *pcb
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
FS_Close(hFile); FS_Close(hFile);
#endif #endif
Sys_Error(__FUNCTION__ ": invalid seek position for %s", path); Sys_Error("%s: invalid seek position for %s", __func__, path);
} }
FS_Seek(hFile, pos, FILESYSTEM_SEEK_HEAD); FS_Seek(hFile, pos, FILESYSTEM_SEEK_HEAD);
@ -2152,7 +2152,7 @@ NOXREF unsigned char *COM_LoadFileLimit(char *path, int pos, int cbmax, int *pcb
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
FS_Close(hFile); FS_Close(hFile);
#endif #endif
Sys_Error(__FUNCTION__ ": not enough space for %s", path); Sys_Error("%s: not enough space for %s", __func__, path);
} }
FS_Close(hFile); FS_Close(hFile);
@ -2228,7 +2228,7 @@ void COM_StripTrailingSlash(char *ppath)
void COM_ParseDirectoryFromCmd(const char *pCmdName, char *pDirName, const char *pDefault) void COM_ParseDirectoryFromCmd(const char *pCmdName, char *pDirName, const char *pDefault)
{ {
const char *pParameter = NULL; const char *pParameter = NULL;
int cmdParameterIndex = COM_CheckParm((char *)pCmdName); int cmdParameterIndex = COM_CheckParm(pCmdName);
if (cmdParameterIndex && cmdParameterIndex < com_argc - 1) if (cmdParameterIndex && cmdParameterIndex < com_argc - 1)
{ {

View File

@ -306,7 +306,7 @@ void COM_UngetToken(void);
char *COM_Parse(char *data); char *COM_Parse(char *data);
char *COM_ParseLine(char *data); char *COM_ParseLine(char *data);
int COM_TokenWaiting(char *buffer); int COM_TokenWaiting(char *buffer);
int COM_CheckParm(char *parm); int COM_CheckParm(const char *parm);
void COM_InitArgv(int argc, char *argv[]); void COM_InitArgv(int argc, char *argv[]);
void COM_Init(char *basedir); void COM_Init(char *basedir);
char *va(char *format, ...); char *va(char *format, ...);

View File

@ -133,7 +133,7 @@ byte COM_BlockSequenceCRCByte(byte *base, int length, int sequence)
CRC32_t crc; CRC32_t crc;
if (sequence < 0) if (sequence < 0)
Sys_Error("sequence < 0, in COM_BlockSequenceCRCByte\n"); Sys_Error("%s: sequence < 0\n", __func__);
p = (byte *)pulCRCTable + sequence % 0x3FC; p = (byte *)pulCRCTable + sequence % 0x3FC;
if (length > 60) if (length > 60)
length = 60; length = 60;

View File

@ -309,7 +309,7 @@ void Cvar_Set(const char *var_name, const char *value)
if (!var) if (!var)
{ {
Con_DPrintf(__FUNCTION__ ": variable \"%s\" not found\n", var_name); Con_DPrintf("%s: variable \"%s\" not found\n", __func__, var_name);
return; return;
} }
@ -351,7 +351,7 @@ void EXT_FUNC Cvar_RegisterVariable(cvar_t *variable)
if (Cmd_Exists(variable->name)) if (Cmd_Exists(variable->name))
{ {
Con_Printf(__FUNCTION__ ": \"%s\" is a command\n", variable->name); Con_Printf("%s: \"%s\" is a command\n", __func__, variable->name);
return; return;
} }

View File

@ -78,7 +78,7 @@ void Draw_CacheWadInitFromFile(FileHandle_t hFile, int len, char *name, int cach
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
FS_Close(hFile); FS_Close(hFile);
#endif #endif
Sys_Error("Wad file %s doesn't have WAD3 id\n", name); Sys_Error("%s: Wad file %s doesn't have WAD3 id\n", __func__, name);
} }
wad->lumps = (lumpinfo_s *)Mem_Malloc(len - header.infotableofs); wad->lumps = (lumpinfo_s *)Mem_Malloc(len - header.infotableofs);
@ -103,7 +103,7 @@ void Draw_CacheWadInit(char *name, int cacheMax, cachewad_t *wad)
int len; int len;
FileHandle_t hFile = FS_Open(name, "rb"); FileHandle_t hFile = FS_Open(name, "rb");
if (!hFile) if (!hFile)
Sys_Error("Draw_LoadWad: Couldn't open %s\n", name); Sys_Error("%s: Couldn't open %s\n", __func__, name);
len = FS_Size(hFile); len = FS_Size(hFile);
Draw_CacheWadInitFromFile(hFile, len, name, cacheMax, wad); Draw_CacheWadInitFromFile(hFile, len, name, cacheMax, wad);
FS_Close(hFile); FS_Close(hFile);
@ -180,7 +180,7 @@ void Draw_MiptexTexture(cachewad_t *wad, unsigned char *data)
byte *pal; byte *pal;
if (wad->cacheExtra != DECAL_EXTRASIZE) if (wad->cacheExtra != DECAL_EXTRASIZE)
Sys_Error("Draw_MiptexTexture: Bad cached wad %s\n", wad->name); Sys_Error("%s: Bad cached wad %s\n", __func__, wad->name);
tex = (texture_t *)data; tex = (texture_t *)data;
mip = (miptex_t *)(data + wad->cacheExtra); mip = (miptex_t *)(data + wad->cacheExtra);
@ -198,7 +198,7 @@ void Draw_MiptexTexture(cachewad_t *wad, unsigned char *data)
tex->offsets[i] = wad->cacheExtra + LittleLong(tmp.offsets[i]); tex->offsets[i] = wad->cacheExtra + LittleLong(tmp.offsets[i]);
pix = tex->width * tex->height; pix = tex->width * tex->height;
palette = (pix>>2) + (pix>>4) + (pix>>6) + pix; palette = (pix >> 2) + (pix >> 4) + (pix >> 6) + pix;
paloffset = tex->offsets[0] + palette + 2; paloffset = tex->offsets[0] + palette + 2;
nSize = *(u_short *)&data[wad->cacheExtra + 40 + palette]; nSize = *(u_short *)&data[wad->cacheExtra + 40 + palette];
pal = (byte *)tex + paloffset; pal = (byte *)tex + paloffset;
@ -228,6 +228,7 @@ void Draw_MiptexTexture(cachewad_t *wad, unsigned char *data)
if (gfCustomBuild) if (gfCustomBuild)
GL_UnloadTexture(tex); GL_UnloadTexture(tex);
paloffset = GL_LoadTexture2(data, GLT_DECAL, tex->width, tex->height, v8, TRUE, 3, pal, gl_filter_max); paloffset = GL_LoadTexture2(data, GLT_DECAL, tex->width, tex->height, v8, TRUE, 3, pal, gl_filter_max);
}
else else
{ {
tex->name[0] = '{'; tex->name[0] = '{';
@ -273,14 +274,14 @@ void Draw_FreeWad(cachewad_t *pWad)
} }
if (pWad->cache) if (pWad->cache)
{ {
#ifndef SWDS #ifndef SWDS
if (pWad->tempWad) if (pWad->tempWad)
{ {
Mem_Free(pWad->cache); Mem_Free(pWad->cache);
pWad->cache = NULL; pWad->cache = NULL;
return; return;
} }
#endif // SWDS #endif // SWDS
for (i = 0, pic = pWad->cache; i < pWad->cacheCount; i++, pic++) for (i = 0, pic = pWad->cache; i < pWad->cacheCount; i++, pic++)
{ {
if (Cache_Check(&pic->cache)) if (Cache_Check(&pic->cache))
@ -310,7 +311,7 @@ NOXREF int Draw_DecalIndex(int id)
char tmp[32]; char tmp[32];
char *pName; char *pName;
if (!decal_names[id][0]) if (!decal_names[id][0])
Sys_Error("Used decal #%d without a name\n", id); Sys_Error("%s: Used decal #%d without a name\n", __func__, id);
pName = decal_names[id]; pName = decal_names[id];
if (!Host_IsServerActive() && violence_hblood.value == 0.0f && !Q_strncmp(pName, "{blood", 6)) if (!Host_IsServerActive() && violence_hblood.value == 0.0f && !Q_strncmp(pName, "{blood", 6))
@ -359,7 +360,7 @@ NOXREF texture_t *Draw_DecalTexture(int index)
{ {
pCust = g_pcl.players[~index].customdata.pNext; pCust = g_pcl.players[~index].customdata.pNext;
if (!pCust || !pCust->bInUse || !pCust->pInfo || !pCust->pBuffer) if (!pCust || !pCust->bInUse || !pCust->pInfo || !pCust->pBuffer)
Sys_Error("Failed to load custom decal for player #%i:%s using default decal 0.\n",~index,g_pcl.players[~index].name); Sys_Error("%s: Failed to load custom decal for player #%i:%s using default decal 0.\n", __func__, ~index, g_pcl.players[~index].name);
retval = (texture_t *)Draw_CustomCacheGet((cachewad_t *)pCust->pInfo, pCust->pBuffer, pCust->resource.nDownloadSize, pCust->nUserData1); retval = (texture_t *)Draw_CustomCacheGet((cachewad_t *)pCust->pInfo, pCust->pBuffer, pCust->resource.nDownloadSize, pCust->nUserData1);
if (!retval) if (!retval)
@ -382,7 +383,7 @@ int Draw_CacheByIndex(cachewad_t *wad, int nIndex, int playernum)
if (i == wad->cacheCount) if (i == wad->cacheCount)
{ {
if (i == wad->cacheMax) if (i == wad->cacheMax)
Sys_Error("Cache wad (%s) out of %d entries", wad->name, i); Sys_Error("%s: Cache wad (%s) out of %d entries", __func__, wad->name, i);
wad->cacheCount++; wad->cacheCount++;
Q_snprintf(pic->name, sizeof(pic->name), "%s", szTestName); Q_snprintf(pic->name, sizeof(pic->name), "%s", szTestName);
} }
@ -459,7 +460,7 @@ void Decal_MergeInDecals(cachewad_t *pwad, const char *pathID)
cachewad_t *final; cachewad_t *final;
if (!pwad) if (!pwad)
Sys_Error("Decal_MergeInDecals called with NULL wad\n"); Sys_Error("%s: called with NULL wad\n", __func__);
lumplist = NULL; lumplist = NULL;
if (!decal_wad) if (!decal_wad)
@ -545,7 +546,7 @@ void Decal_Init(void)
#else #else
if (i == 0 && !hfile) if (i == 0 && !hfile)
#endif #endif
Sys_Error("Couldn't find '%s' in \"%s\" search path\n", "decals.wad", pszPathID[i]); Sys_Error("%s: Couldn't find '%s' in \"%s\" search path\n", __func__, "decals.wad", pszPathID[i]);
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
found = true; found = true;
@ -563,7 +564,7 @@ void Decal_Init(void)
sv_decalnamecount = Draw_DecalCount(); sv_decalnamecount = Draw_DecalCount();
if (sv_decalnamecount > MAX_DECALS) if (sv_decalnamecount > MAX_DECALS)
Sys_Error("Too many decals: %d / %d\n", sv_decalnamecount, MAX_DECALS); Sys_Error("%s: Too many decals: %d / %d\n", __func__, sv_decalnamecount, MAX_DECALS);
for (i = 0; i < sv_decalnamecount; i++) for (i = 0; i < sv_decalnamecount; i++)
{ {
@ -614,7 +615,7 @@ NOXREF void *Draw_CacheGet(cachewad_t *wad, int index)
lumpinfo_t *pLump; lumpinfo_t *pLump;
if (index >= wad->cacheCount) if (index >= wad->cacheCount)
Sys_Error("Cache wad indexed before load %s: %d", wad->name, index); Sys_Error("%s: Cache wad indexed before load %s: %d", __func__, wad->name, index);
pic = wad->cache; pic = wad->cache;
dat = Cache_Check(&pic[index].cache); dat = Cache_Check(&pic[index].cache);
@ -639,7 +640,7 @@ NOXREF void *Draw_CacheGet(cachewad_t *wad, int index)
if (Draw_CacheReload(wad, i, pLump, pic, clean, path)) if (Draw_CacheReload(wad, i, pLump, pic, clean, path))
{ {
if (pic->cache.data == NULL) if (pic->cache.data == NULL)
Sys_Error("Draw_CacheGet: failed to load %s", path); Sys_Error("%s: failed to load %s", __func__, path);
dat = pic->cache.data; dat = pic->cache.data;
} }
} }
@ -654,7 +655,7 @@ void *Draw_CustomCacheGet(cachewad_t *wad, void *raw, int rawsize, int index)
char clean[16]; char clean[16];
if (wad->cacheCount <= index) if (wad->cacheCount <= index)
Sys_Error("Cache wad indexed before load %s: %d", wad->name, index); Sys_Error("%s: Cache wad indexed before load %s: %d", __func__, wad->name, index);
pic = &wad->cache[index]; pic = &wad->cache[index];
pdata = Cache_Check(&pic->cache); pdata = Cache_Check(&pic->cache);
@ -666,7 +667,7 @@ void *Draw_CustomCacheGet(cachewad_t *wad, void *raw, int rawsize, int index)
if (Draw_CacheLoadFromCustom(clean, wad, raw, rawsize, pic)) if (Draw_CacheLoadFromCustom(clean, wad, raw, rawsize, pic))
{ {
if (!pic->cache.data) if (!pic->cache.data)
Sys_Error("Draw_CacheGet: failed to load %s", pic->name); Sys_Error("%s: failed to load %s", __func__, pic->name);
pdata = pic->cache.data; pdata = pic->cache.data;
} }
} }
@ -696,9 +697,9 @@ NOXREF qboolean Draw_CacheReload(cachewad_t *wad, int i, lumpinfo_t *pLump, cach
} }
else else
#endif // SWDS #endif // SWDS
buf = (byte *)Cache_Alloc(&pic->cache, wad->cacheExtra + pLump->size + 1, clean); buf = (byte *)Cache_Alloc(&pic->cache, wad->cacheExtra + pLump->size + 1, clean);
if (!buf) if (!buf)
Sys_Error("Draw_CacheGet: not enough space for %s in %s", path, wad->name); Sys_Error("%s: not enough space for %s in %s", __func__, path, wad->name);
buf[pLump->size + wad->cacheExtra] = 0; buf[pLump->size + wad->cacheExtra] = 0;
FS_Seek(hFile, pLump->filepos, FILESYSTEM_SEEK_HEAD); FS_Seek(hFile, pLump->filepos, FILESYSTEM_SEEK_HEAD);
@ -725,7 +726,7 @@ qboolean Draw_ValidateCustomLogo(cachewad_t *wad, unsigned char *data, lumpinfo_
if (wad->cacheExtra != DECAL_EXTRASIZE) if (wad->cacheExtra != DECAL_EXTRASIZE)
{ {
Con_Printf(__FUNCTION__ ": Bad cached wad %s\n", wad->name); Con_Printf("%s: Bad cached wad %s\n", __func__, wad->name);
return FALSE; return FALSE;
} }
@ -745,29 +746,29 @@ qboolean Draw_ValidateCustomLogo(cachewad_t *wad, unsigned char *data, lumpinfo_
tex.offsets[i] = wad->cacheExtra + LittleLong(tmp.offsets[i]); tex.offsets[i] = wad->cacheExtra + LittleLong(tmp.offsets[i]);
pix = tex.width * tex.height; pix = tex.width * tex.height;
pixoffset = pix + (pix>>2) + (pix>>4) + (pix>>6); pixoffset = pix + (pix >> 2) + (pix >> 4) + (pix >> 6);
paloffset = (pix>>2) + tmp.offsets[0] + pix; paloffset = (pix >> 2) + tmp.offsets[0] + pix;
palettesize = (pix>>4) + paloffset; palettesize = (pix >> 4) + paloffset;
nPalleteCount = *(u_short *)(data + pixoffset + sizeof(texture_t)); nPalleteCount = *(u_short *)(data + pixoffset + sizeof(texture_t));
if (!tex.width || tex.width > 256 || tex.height > 256 if (!tex.width || tex.width > 256 || tex.height > 256
|| (tmp.offsets[0] + pix != tmp.offsets[1]) || (tmp.offsets[0] + pix != tmp.offsets[1])
|| paloffset != tmp.offsets[2] || palettesize != tmp.offsets[3]) || paloffset != tmp.offsets[2] || palettesize != tmp.offsets[3])
{ {
Con_Printf(__FUNCTION__ ": Bad cached wad %s\n", wad->name); Con_Printf("%s: Bad cached wad %s\n", __func__, wad->name);
return FALSE; return FALSE;
} }
if (nPalleteCount > 256) if (nPalleteCount > 256)
{ {
Con_Printf(__FUNCTION__ ": Bad cached wad palette size %i on %s\n", nPalleteCount, wad->name); Con_Printf("%s: Bad cached wad palette size %i on %s\n", __func__, nPalleteCount, wad->name);
return FALSE; return FALSE;
} }
nSize = pixoffset + LittleLong(tmp.offsets[0]) + 3 * nPalleteCount + 2; nSize = pixoffset + LittleLong(tmp.offsets[0]) + 3 * nPalleteCount + 2;
if (nSize > lump->disksize) if (nSize > lump->disksize)
{ {
Con_Printf(__FUNCTION__ ": Bad cached wad %s\n", wad->name); Con_Printf("%s: Bad cached wad %s\n", __func__, wad->name);
return FALSE; return FALSE;
} }
@ -791,7 +792,7 @@ qboolean Draw_CacheLoadFromCustom(char *clean, cachewad_t *wad, void *raw, int r
pLump = &wad->lumps[idx]; pLump = &wad->lumps[idx];
buf = (byte *)Cache_Alloc(&pic->cache, wad->cacheExtra + pLump->size + 1, clean); buf = (byte *)Cache_Alloc(&pic->cache, wad->cacheExtra + pLump->size + 1, clean);
if (!buf) if (!buf)
Sys_Error("Draw_CacheGet: not enough space for %s in %s", clean, wad->name); Sys_Error("%s: not enough space for %s in %s", __func__, clean, wad->name);
buf[wad->cacheExtra + pLump->size] = 0; buf[wad->cacheExtra + pLump->size] = 0;
Q_memcpy((char *)buf + wad->cacheExtra, (char *)raw + pLump->filepos, pLump->size); Q_memcpy((char *)buf + wad->cacheExtra, (char *)raw + pLump->filepos, pLump->size);
@ -824,7 +825,7 @@ NOXREF int Draw_CacheIndex(cachewad_t *wad, char *path)
if (i == wad->cacheCount) if (i == wad->cacheCount)
{ {
if (wad->cacheMax == wad->cacheCount) if (wad->cacheMax == wad->cacheCount)
Sys_Error("Cache wad (%s) out of %d entries"); Sys_Error("%s: Cache wad (%s) out of %d entries", __func__);
wad->cacheCount++; wad->cacheCount++;
Q_strncpy(wad->name, path, 63); Q_strncpy(wad->name, path, 63);

View File

@ -326,7 +326,7 @@ delta_description_t *DELTA_FindField(delta_t *pFields, const char *pszField)
} }
} }
Con_Printf(__FUNCTION__ ": Warning, couldn't find %s\n", pszField); Con_Printf("%s: Warning, couldn't find %s\n", __func__, pszField);
return NULL; return NULL;
} }
@ -343,7 +343,7 @@ int EXT_FUNC DELTA_FindFieldIndex(struct delta_s *pFields, const char *fieldname
} }
} }
Con_Printf(__FUNCTION__ ": Warning, couldn't find %s\n", fieldname); Con_Printf("%s: Warning, couldn't find %s\n", __func__, fieldname);
return -1; return -1;
} }
@ -471,7 +471,7 @@ int DELTA_TestDelta(unsigned char *from, unsigned char *to, delta_t *pFields)
} }
break; break;
default: default:
Con_Printf(__FUNCTION__ ": Bad field type %i\n", fieldType); Con_Printf("%s: Bad field type %i\n", __func__, fieldType);
break; break;
} }
@ -559,7 +559,7 @@ void DELTA_MarkSendFields(unsigned char *from, unsigned char *to, delta_t *pFiel
pTest->flags |= FDT_MARK; pTest->flags |= FDT_MARK;
break; break;
default: default:
Con_Printf(__FUNCTION__ ": Bad field type %i\n", fieldType); Con_Printf("%s: Bad field type %i\n", __func__, fieldType);
break; break;
} }
} }
@ -715,7 +715,7 @@ void DELTA_WriteMarkedFields(unsigned char *from, unsigned char *to, delta_t *pF
MSG_WriteBitString((const char *)&to[pTest->fieldOffset]); MSG_WriteBitString((const char *)&to[pTest->fieldOffset]);
break; break;
default: default:
Con_Printf(__FUNCTION__ ": unknown send field type\n"); Con_Printf("%s: unknown send field type\n", __func__);
break; break;
} }
} }
@ -843,7 +843,7 @@ int DELTA_ParseDelta(unsigned char *from, unsigned char *to, delta_t *pFields)
Q_strcpy((char *)&to[pTest->fieldOffset], (char *)&from[pTest->fieldOffset]); Q_strcpy((char *)&to[pTest->fieldOffset], (char *)&from[pTest->fieldOffset]);
break; break;
default: default:
Con_Printf(__FUNCTION__ ": unparseable field type %i\n", fieldType); Con_Printf("%s: unparseable field type %i\n", __func__, fieldType);
} }
continue; continue;
} }
@ -985,7 +985,7 @@ int DELTA_ParseDelta(unsigned char *from, unsigned char *to, delta_t *pFields)
} while (c); } while (c);
break; break;
default: default:
Con_Printf(__FUNCTION__ ": unparseable field type %i\n", fieldType); Con_Printf("%s: unparseable field type %i\n", __func__, fieldType);
break; break;
} }
} }
@ -1085,7 +1085,7 @@ delta_t *DELTA_BuildFromLinks(delta_link_t **pplinks)
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
if (count > DELTA_MAX_FIELDS) if (count > DELTA_MAX_FIELDS)
Sys_Error(__FUNCTION__ ": Too many fields in delta description %i (MAX %i)\n", count, DELTA_MAX_FIELDS); Sys_Error("%s: Too many fields in delta description %i (MAX %i)\n", __func__, count, DELTA_MAX_FIELDS);
#endif #endif
pdesc = (delta_description_t *)Mem_ZeroMalloc(sizeof(delta_description_t) * count); pdesc = (delta_description_t *)Mem_ZeroMalloc(sizeof(delta_description_t) * count);
@ -1116,7 +1116,7 @@ int DELTA_FindOffset(int count, delta_definition_t *pdef, char *fieldname)
} }
} }
Sys_Error(__FUNCTION__ ": Couldn't find offset for %s!!!\n", fieldname); Sys_Error("%s: Couldn't find offset for %s!!!\n", __func__, fieldname);
} }
qboolean DELTA_ParseType(delta_description_t *pdelta, char **pstream) qboolean DELTA_ParseType(delta_description_t *pdelta, char **pstream)
@ -1150,11 +1150,11 @@ qboolean DELTA_ParseType(delta_description_t *pdelta, char **pstream)
else if (!Q_stricmp(com_token, "DT_STRING")) else if (!Q_stricmp(com_token, "DT_STRING"))
pdelta->fieldType |= DT_STRING; pdelta->fieldType |= DT_STRING;
else else
Sys_Error(__FUNCTION__ ": Unknown type or type flag %s\n", com_token); Sys_Error("%s: Unknown type or type flag %s\n", __func__, com_token);
} }
// We are hit the end of the stream // We are hit the end of the stream
Sys_Error(__FUNCTION__ ": Expecting fieldtype info\n"); // Was Con_Printf here Sys_Error("%s: Expecting fieldtype info\n", __func__); // Was Con_Printf here
return FALSE; return FALSE;
} }
@ -1167,7 +1167,7 @@ qboolean DELTA_ParseField(int count, delta_definition_t *pdefinition, delta_link
{ {
if (Q_stricmp(com_token, "DEFINE_DELTA_POST")) if (Q_stricmp(com_token, "DEFINE_DELTA_POST"))
{ {
Sys_Error(__FUNCTION__ ": Expecting DEFINE_*, got %s\n", com_token); Sys_Error("%s: Expecting DEFINE_*, got %s\n", __func__, com_token);
} }
readpost = 1; readpost = 1;
} }
@ -1175,13 +1175,13 @@ qboolean DELTA_ParseField(int count, delta_definition_t *pdefinition, delta_link
*pstream = COM_Parse(*pstream); *pstream = COM_Parse(*pstream);
if (Q_stricmp(com_token, "(")) if (Q_stricmp(com_token, "("))
{ {
Sys_Error(__FUNCTION__ ": Expecting (, got %s\n", com_token); Sys_Error("%s: Expecting (, got %s\n", __func__, com_token);
} }
*pstream = COM_Parse(*pstream); *pstream = COM_Parse(*pstream);
if (com_token[0] == 0) if (com_token[0] == 0)
{ {
Sys_Error(__FUNCTION__ ": Expecting fieldname\n"); Sys_Error("%s: Expecting fieldname\n", __func__);
} }
Q_strncpy(pField->delta->fieldName, com_token, 31); Q_strncpy(pField->delta->fieldName, com_token, 31);
@ -1215,7 +1215,7 @@ qboolean DELTA_ParseField(int count, delta_definition_t *pdefinition, delta_link
*pstream = COM_Parse(*pstream); *pstream = COM_Parse(*pstream);
if (Q_stricmp(com_token, ")")) if (Q_stricmp(com_token, ")"))
{ {
Sys_Error(__FUNCTION__ ": Expecting ), got %s\n", com_token); // Was Con_Printf here Sys_Error("%s: Expecting ), got %s\n", __func__, com_token); // Was Con_Printf here
return FALSE; return FALSE;
} }
@ -1309,7 +1309,7 @@ void DELTA_SkipDescription(char **pstream)
*pstream = COM_Parse(*pstream); *pstream = COM_Parse(*pstream);
if (com_token[0] == 0) if (com_token[0] == 0)
{ {
Sys_Error(__FUNCTION__ ": Error during description skip"); Sys_Error("%s: Error during description skip", __func__);
} }
} while (Q_stricmp(com_token, "}")); } while (Q_stricmp(com_token, "}"));
} }
@ -1363,13 +1363,13 @@ qboolean DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream)
if (!ppdesc) if (!ppdesc)
{ {
Sys_Error(__FUNCTION__ " with no delta_description_t\n"); Sys_Error("%s: called with no delta_description_t\n", __func__);
} }
*ppdesc = 0; *ppdesc = 0;
if (!pstream) if (!pstream)
{ {
Sys_Error(__FUNCTION__ " with no data stream\n"); Sys_Error("%s: called with no data stream\n", __func__);
} }
while (true) while (true)
@ -1389,14 +1389,14 @@ qboolean DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream)
pdefinition = DELTA_FindDefinition(com_token, &count); pdefinition = DELTA_FindDefinition(com_token, &count);
if (!pdefinition) if (!pdefinition)
{ {
Sys_Error(__FUNCTION__ ": Unknown data type: %s\n", com_token); Sys_Error("%s: Unknown data type: %s\n", __func__, com_token);
} }
// Parse source of conditional encoder // Parse source of conditional encoder
pstream = COM_Parse(pstream); pstream = COM_Parse(pstream);
if (com_token[0] == 0) if (com_token[0] == 0)
{ {
Sys_Error(__FUNCTION__ ": Unknown encoder : %s\nValid values:\nnone\ngamedll funcname\nclientdll funcname\n", com_token); Sys_Error("%s: Unknown encoder : %s\nValid values:\nnone\ngamedll funcname\nclientdll funcname\n", __func__, com_token);
} }
if (Q_stricmp(com_token, "none")) if (Q_stricmp(com_token, "none"))
{ {
@ -1407,7 +1407,7 @@ qboolean DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream)
pstream = COM_Parse(pstream); pstream = COM_Parse(pstream);
if (com_token[0] == 0) if (com_token[0] == 0)
{ {
Sys_Error(__FUNCTION__ ": Expecting encoder\n"); Sys_Error("%s: Expecting encoder\n", __func__);
} }
Q_strncpy(encoder, com_token, sizeof(encoder)-1); Q_strncpy(encoder, com_token, sizeof(encoder)-1);
@ -1428,7 +1428,7 @@ qboolean DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream)
} }
if (Q_stricmp(com_token, "{")) if (Q_stricmp(com_token, "{"))
{ {
Sys_Error(__FUNCTION__ ": Expecting {, got %s\n", com_token); // Was Con_Printf here Sys_Error("%s: Expecting {, got %s\n", __func__, com_token); // Was Con_Printf here
return FALSE; return FALSE;
} }
if (!DELTA_ParseOneField(&pstream, &links, count, pdefinition)) if (!DELTA_ParseOneField(&pstream, &links, count, pdefinition))
@ -1459,7 +1459,7 @@ qboolean DELTA_Load(char *name, delta_t **ppdesc, char *pszFile)
pbuf = (char *)COM_LoadFile(pszFile, 5, 0); pbuf = (char *)COM_LoadFile(pszFile, 5, 0);
if (!pbuf) if (!pbuf)
{ {
Sys_Error(__FUNCTION__ ": Couldn't load file %s\n", pszFile); Sys_Error("%s: Couldn't load file %s\n", __func__, pszFile);
} }
bret = DELTA_ParseDescription(name, ppdesc, pbuf); bret = DELTA_ParseDescription(name, ppdesc, pbuf);

View File

@ -30,7 +30,7 @@ unsigned int DELTAJIT_GetFieldSize(delta_description_t* desc) {
return 0; return 0;
default: default:
Sys_Error(__FUNCTION__ ": Unknown delta field type %d", desc->fieldType); Sys_Error("%s: Unknown delta field type %d", __func__, desc->fieldType);
return 0; return 0;
} }
} }
@ -56,11 +56,11 @@ void DELTAJIT_CreateDescription(delta_t* delta, deltajitdata_t &jitdesc) {
// sanity checks & pre-clean // sanity checks & pre-clean
if (numMemBlocks > DELTAJIT_MAX_BLOCKS) { if (numMemBlocks > DELTAJIT_MAX_BLOCKS) {
Sys_Error(__FUNCTION__ ": numMemBlocks > DELTAJIT_MAX_BLOCKS (%d > %d)", numMemBlocks, DELTAJIT_MAX_BLOCKS); Sys_Error("%s: numMemBlocks > DELTAJIT_MAX_BLOCKS (%d > %d)", __func__, numMemBlocks, DELTAJIT_MAX_BLOCKS);
} }
if (delta->fieldCount > DELTAJIT_MAX_FIELDS) { if (delta->fieldCount > DELTAJIT_MAX_FIELDS) {
Sys_Error(__FUNCTION__ ": fieldCount > DELTAJIT_MAX_FIELDS (%d > %d)", delta->fieldCount, DELTAJIT_MAX_FIELDS); Sys_Error("%s: fieldCount > DELTAJIT_MAX_FIELDS (%d > %d)", __func__, delta->fieldCount, DELTAJIT_MAX_FIELDS);
} }
Q_memset(&jitdesc, 0, sizeof(jitdesc)); Q_memset(&jitdesc, 0, sizeof(jitdesc));
@ -684,20 +684,20 @@ CDeltaJit* DELTAJit_LookupDeltaJit(const char* callsite, delta_t *pFields) {
} }
NOINLINE int DELTAJit_Fields_Clear_Mark_Check(unsigned char *from, unsigned char *to, delta_t *pFields, void* pForceMarkMask) { NOINLINE int DELTAJit_Fields_Clear_Mark_Check(unsigned char *from, unsigned char *to, delta_t *pFields, void* pForceMarkMask) {
CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__FUNCTION__, pFields); CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__func__, pFields);
CDeltaClearMarkFieldsJIT &func = *deltaJit->cleanMarkCheckFunc; CDeltaClearMarkFieldsJIT &func = *deltaJit->cleanMarkCheckFunc;
return func(from, to, deltaJit, pForceMarkMask); return func(from, to, deltaJit, pForceMarkMask);
} }
NOINLINE int DELTAJit_TestDelta(unsigned char *from, unsigned char *to, delta_t *pFields) NOINLINE int DELTAJit_TestDelta(unsigned char *from, unsigned char *to, delta_t *pFields)
{ {
CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__FUNCTION__, pFields); CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__func__, pFields);
CDeltaTestDeltaJIT &func = *deltaJit->testDeltaFunc; CDeltaTestDeltaJIT &func = *deltaJit->testDeltaFunc;
return func(from, to, deltaJit); return func(from, to, deltaJit);
} }
void DELTAJit_SetSendFlagBits(delta_t *pFields, int *bits, int *bytecount) { void DELTAJit_SetSendFlagBits(delta_t *pFields, int *bits, int *bytecount) {
CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__FUNCTION__, pFields); CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__func__, pFields);
bits[0] = deltaJit->marked_fields_mask.u32[0]; bits[0] = deltaJit->marked_fields_mask.u32[0];
bits[1] = deltaJit->marked_fields_mask.u32[1]; bits[1] = deltaJit->marked_fields_mask.u32[1];
@ -706,29 +706,29 @@ void DELTAJit_SetSendFlagBits(delta_t *pFields, int *bits, int *bytecount) {
void DELTAJit_SetFieldByIndex(struct delta_s *pFields, int fieldNumber) void DELTAJit_SetFieldByIndex(struct delta_s *pFields, int fieldNumber)
{ {
CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__FUNCTION__, pFields); CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__func__, pFields);
deltaJit->marked_fields_mask.u32[fieldNumber >> 5] |= (1 << (fieldNumber & 31)); deltaJit->marked_fields_mask.u32[fieldNumber >> 5] |= (1 << (fieldNumber & 31));
} }
void DELTAJit_UnsetFieldByIndex(struct delta_s *pFields, int fieldNumber) void DELTAJit_UnsetFieldByIndex(struct delta_s *pFields, int fieldNumber)
{ {
CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__FUNCTION__, pFields); CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__func__, pFields);
deltaJit->marked_fields_mask.u32[fieldNumber >> 5] &= ~(1 << (fieldNumber & 31)); deltaJit->marked_fields_mask.u32[fieldNumber >> 5] &= ~(1 << (fieldNumber & 31));
} }
qboolean DELTAJit_IsFieldMarked(delta_t* pFields, int fieldNumber) qboolean DELTAJit_IsFieldMarked(delta_t* pFields, int fieldNumber)
{ {
CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__FUNCTION__, pFields); CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__func__, pFields);
return deltaJit->marked_fields_mask.u32[fieldNumber >> 5] & (1 << (fieldNumber & 31)); return deltaJit->marked_fields_mask.u32[fieldNumber >> 5] & (1 << (fieldNumber & 31));
} }
uint64 DELTAJit_GetOriginalMask(delta_t* pFields) { uint64 DELTAJit_GetOriginalMask(delta_t* pFields) {
CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__FUNCTION__, pFields); CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__func__, pFields);
return deltaJit->originalMarkedFieldsMask.u64; return deltaJit->originalMarkedFieldsMask.u64;
} }
uint64 DELTAJit_GetMaskU64(delta_t* pFields) { uint64 DELTAJit_GetMaskU64(delta_t* pFields) {
CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__FUNCTION__, pFields); CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__func__, pFields);
return deltaJit->marked_fields_mask.u64; return deltaJit->marked_fields_mask.u64;
} }

View File

@ -40,7 +40,7 @@ char* Ed_StrPool_Alloc(const char* origStr) {
unsigned int len = Q_strlen(origStr) + 1; unsigned int len = Q_strlen(origStr) + 1;
if (len >= ARRAYSIZE(str)) { if (len >= ARRAYSIZE(str)) {
Sys_Error(__FUNCTION__ ": Too long string allocated: %s", origStr); Sys_Error("%s: Too long string allocated: %s", __func__, origStr);
} }
Q_strcpy(str, origStr); Q_strcpy(str, origStr);

View File

@ -72,7 +72,7 @@ qboolean HPAK_GetDataPointer(char *pakname, struct resource_s *pResource, unsign
{ {
pbuf = (byte *)Mem_Malloc(p->datasize); pbuf = (byte *)Mem_Malloc(p->datasize);
if (!pbuf) if (!pbuf)
Sys_Error("Error allocating %i bytes for hpak!", p->datasize); Sys_Error("%s: Error allocating %i bytes for hpak!", __func__, p->datasize);
Q_memcpy((void *)pbuf, p->data, p->datasize); Q_memcpy((void *)pbuf, p->data, p->datasize);
*pbuffer = pbuf; *pbuffer = pbuf;
} }
@ -173,7 +173,7 @@ void HPAK_AddToQueue(char *pakname, struct resource_s *pResource, void *pData, F
{ {
hash_pack_queue_t *n = (hash_pack_queue_t *)Mem_Malloc(sizeof(hash_pack_queue_t)); hash_pack_queue_t *n = (hash_pack_queue_t *)Mem_Malloc(sizeof(hash_pack_queue_t));
if (!n) if (!n)
Sys_Error("Unable to allocate %i bytes for hpak queue!", sizeof(hash_pack_queue_t)); Sys_Error("%s: Unable to allocate %i bytes for hpak queue!", __func__, sizeof(hash_pack_queue_t));
Q_memset(n, 0, sizeof(hash_pack_queue_t)); Q_memset(n, 0, sizeof(hash_pack_queue_t));
n->pakname = Mem_Strdup(pakname); n->pakname = Mem_Strdup(pakname);
@ -181,7 +181,7 @@ void HPAK_AddToQueue(char *pakname, struct resource_s *pResource, void *pData, F
n->datasize = pResource->nDownloadSize; n->datasize = pResource->nDownloadSize;
n->data = Mem_Malloc(pResource->nDownloadSize); n->data = Mem_Malloc(pResource->nDownloadSize);
if (!n->data) if (!n->data)
Sys_Error("Unable to allocate %i bytes for hpak queue!", n->datasize); Sys_Error("%s: Unable to allocate %i bytes for hpak queue!", __func__, n->datasize);
if (pData) if (pData)
{ {
@ -192,7 +192,7 @@ void HPAK_AddToQueue(char *pakname, struct resource_s *pResource, void *pData, F
else else
{ {
if (!fpSource) if (!fpSource)
Sys_Error("Add to Queue called without data or file pointer!"); Sys_Error("%s: Add to Queue called without data or file pointer!", __func__);
FS_Read(n->data, n->datasize, 1, fpSource); FS_Read(n->data, n->datasize, 1, fpSource);
n->next = gp_hpak_queue; n->next = gp_hpak_queue;
gp_hpak_queue = n; gp_hpak_queue = n;
@ -422,7 +422,7 @@ void HPAK_RemoveLump(char *pakname, resource_t *pResource)
if (pakname == NULL || *pakname == '\0' || pResource == NULL) if (pakname == NULL || *pakname == '\0' || pResource == NULL)
{ {
Con_Printf(__FUNCTION__ ": Invalid arguments\n"); Con_Printf("%s: Invalid arguments\n", __func__);
return; return;
} }
HPAK_FlushHostQueue(); HPAK_FlushHostQueue();

View File

@ -105,7 +105,7 @@ NOXREF void Host_EndGame(const char *message, ...)
Q_vsnprintf(string, sizeof(string), message, argptr); Q_vsnprintf(string, sizeof(string), message, argptr);
va_end(argptr); va_end(argptr);
Con_DPrintf(__FUNCTION__ ": %s\n", string); Con_DPrintf("%s: %s\n", __func__, string);
oldn = g_pcls.demonum; oldn = g_pcls.demonum;
@ -116,7 +116,7 @@ NOXREF void Host_EndGame(const char *message, ...)
if (!g_pcls.state) if (!g_pcls.state)
{ {
Sys_Error(__FUNCTION__ ": %s\n", string); Sys_Error("%s: %s\n", __func__, string);
} }
if (oldn != -1) if (oldn != -1)
@ -142,7 +142,7 @@ void NORETURN Host_Error(const char *error, ...)
va_start(argptr, error); va_start(argptr, error);
if (inerror) if (inerror)
Sys_Error(__FUNCTION__ ": recursively entered"); Sys_Error("%s: recursively entered", __func__);
inerror = TRUE; inerror = TRUE;
SCR_EndLoadingPlaque(); SCR_EndLoadingPlaque();
@ -152,7 +152,7 @@ void NORETURN Host_Error(const char *error, ...)
if (g_psv.active && developer.value != 0.0 ) if (g_psv.active && developer.value != 0.0 )
CL_WriteMessageHistory(0, 0); CL_WriteMessageHistory(0, 0);
Con_Printf(__FUNCTION__ ": %s\n", string); Con_Printf("%s: %s\n", __func__, string);
if (g_psv.active) if (g_psv.active)
Host_ShutdownServer(FALSE); Host_ShutdownServer(FALSE);
@ -163,7 +163,7 @@ void NORETURN Host_Error(const char *error, ...)
inerror = FALSE; inerror = FALSE;
longjmp(host_abortserver, 1); longjmp(host_abortserver, 1);
} }
Sys_Error(__FUNCTION__ ": %s\n", string); Sys_Error("%s: %s\n", __func__, string);
} }
void Host_InitLocal(void) void Host_InitLocal(void)
@ -1161,11 +1161,11 @@ int Host_Init(quakeparms_t *parms)
Q_memset(&g_module, 0, sizeof(g_module)); Q_memset(&g_module, 0, sizeof(g_module));
if (g_pcls.state != ca_dedicated) if (g_pcls.state != ca_dedicated)
{ {
//Sys_Error("Only dedicated server mode is supported"); //Sys_Error("%s: Only dedicated server mode is supported", __func__);
color24 *disk_basepal = (color24 *)COM_LoadHunkFile("gfx/palette.lmp"); color24 *disk_basepal = (color24 *)COM_LoadHunkFile("gfx/palette.lmp");
if (!disk_basepal) if (!disk_basepal)
Sys_Error("Host_Init: Couldn't load gfx/palette.lmp"); Sys_Error("%s: Couldn't load gfx/palette.lmp", __func__);
host_basepal = (unsigned short *)Hunk_AllocName(sizeof(PackedColorVec) * 256, "palette.lmp"); host_basepal = (unsigned short *)Hunk_AllocName(sizeof(PackedColorVec) * 256, "palette.lmp");
for (int i = 0; i < 256; i++) for (int i = 0; i < 256; i++)

View File

@ -1715,7 +1715,7 @@ void EntityInit(edict_t *pEdict, int className)
{ {
ENTITYINIT pEntityInit; ENTITYINIT pEntityInit;
if (!className) if (!className)
Sys_Error("Bad class!!\n"); Sys_Error("%s: Bad class!!\n", __func__);
ReleaseEntityDLLFields(pEdict); ReleaseEntityDLLFields(pEdict);
InitEntityDLLFields(pEdict); InitEntityDLLFields(pEdict);
@ -1935,7 +1935,7 @@ int LoadGamestate(char *level, int createPlayers)
else else
{ {
if (!(pEntInfo->flags & FENTTABLE_PLAYER)) if (!(pEntInfo->flags & FENTTABLE_PLAYER))
Sys_Error("ENTITY IS NOT A PLAYER: %d\n", i); Sys_Error("%s: ENTITY IS NOT A PLAYER: %d\n", __func__, i);
pent = g_psvs.clients[pEntInfo->id - 1].edict; pent = g_psvs.clients[pEntInfo->id - 1].edict;
if (createPlayers && pent) if (createPlayers && pent)
@ -2048,7 +2048,7 @@ int CreateEntityList(SAVERESTOREDATA *pSaveData, int levelMask)
if (pent && !pent->free) if (pent && !pent->free)
{ {
if (!(pEntInfo->flags & FENTTABLE_PLAYER)) if (!(pEntInfo->flags & FENTTABLE_PLAYER))
Sys_Error("ENTITY IS NOT A PLAYER: %d\n", i); Sys_Error("%s: ENTITY IS NOT A PLAYER: %d\n", __func__, i);
if (cl->active) if (cl->active)
EntityInit(pent, pEntInfo->classname); EntityInit(pent, pEntInfo->classname);
@ -2339,7 +2339,7 @@ void Host_Changelevel2_f(void)
FS_LogLevelLoadStarted(level); FS_LogLevelLoadStarted(level);
if (!SV_SpawnServer(FALSE, level, startspot)) if (!SV_SpawnServer(FALSE, level, startspot))
Sys_Error("Host_Changelevel2: Couldn't load map %s\n", level); Sys_Error("%s: Couldn't load map %s\n", __func__, level);
if (pSaveData) if (pSaveData)
SaveExit(pSaveData); SaveExit(pSaveData);

View File

@ -39,7 +39,7 @@ vec3_t vec3_origin;
// aligned vec4_t // aligned vec4_t
typedef ALIGN16 vec4_t avec4_t; typedef ALIGN16 vec4_t avec4_t;
typedef ALIGN16 int aivec4_t[4]; typedef ALIGN16 unsigned int aivec4_t[4];
// conversion multiplier // conversion multiplier
const avec4_t deg2rad = const avec4_t deg2rad =
@ -116,7 +116,7 @@ float anglemod(float a)
void BOPS_Error(void) void BOPS_Error(void)
{ {
Sys_Error("BoxOnPlaneSide: Bad signbits"); Sys_Error("%s: Bad signbits", __func__);
} }
#ifdef REHLDS_OPT_PEDANTIC #ifdef REHLDS_OPT_PEDANTIC

View File

@ -68,14 +68,14 @@ void* EXT_FUNC Mod_Extradata(model_t *mod)
if (mod->type == mod_brush) if (mod->type == mod_brush)
{ {
Sys_Error(__FUNCTION__ ": called with mod_brush!\n"); Sys_Error("%s: called with mod_brush!\n", __func__);
} }
Mod_LoadModel(mod, 1, 0); Mod_LoadModel(mod, 1, 0);
if (mod->cache.data == NULL) if (mod->cache.data == NULL)
{ {
Sys_Error(__FUNCTION__ ": caching failed"); Sys_Error("%s: caching failed", __func__);
} }
return mod->cache.data; return mod->cache.data;
@ -88,7 +88,7 @@ mleaf_t *Mod_PointInLeaf(vec_t *p, model_t *model)
mplane_t *plane; mplane_t *plane;
if (!model || !model->nodes) if (!model || !model->nodes)
Sys_Error(__FUNCTION__ ": bad model"); Sys_Error("%s: bad model", __func__);
node = model->nodes; node = model->nodes;
while (node->contents >= 0) while (node->contents >= 0)
@ -140,7 +140,7 @@ model_t *Mod_FindName(qboolean trackCRC, const char *name)
avail = NULL; avail = NULL;
if (!name[0]) if (!name[0])
Sys_Error("Mod_ForName: NULL name"); Sys_Error("%s: NULL name", __func__);
for (i = 0, mod = mod_known; i < mod_numknown; i++, mod++) for (i = 0, mod = mod_known; i < mod_numknown; i++, mod++)
{ {
@ -164,7 +164,7 @@ model_t *Mod_FindName(qboolean trackCRC, const char *name)
else else
{ {
if (!avail) if (!avail)
Sys_Error("mod_numknown >= MAX_KNOWN_MODELS"); Sys_Error("%s: mod_numknown >= MAX_KNOWN_MODELS", __func__);
mod = avail; mod = avail;
Mod_FillInCRCInfo(trackCRC, avail - mod_known); Mod_FillInCRCInfo(trackCRC, avail - mod_known);
} }
@ -286,7 +286,7 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean trackCRC)
if (!buf) if (!buf)
{ {
if (crash) if (crash)
Sys_Error("Mod_NumForName: %s not found", mod->name); Sys_Error("%s: %s not found", __func__, mod->name);
return 0; return 0;
} }
@ -303,7 +303,7 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean trackCRC)
{ {
if (currentCRC != p->initialCRC) if (currentCRC != p->initialCRC)
{ {
Sys_Error("%s has been modified since starting the engine. Consider running system diagnostics to check for faulty hardware.\n", mod->name); Sys_Error("%s: %s has been modified since starting the engine. Consider running system diagnostics to check for faulty hardware.\n", __func__, mod->name);
} }
} }
else else
@ -495,7 +495,7 @@ void Mod_LoadTextures(lump_t *l)
mt->width = LittleLong(mt->width); mt->width = LittleLong(mt->width);
mt->height = LittleLong(mt->height); mt->height = LittleLong(mt->height);
if (mt->width & 0xF || mt->height & 0xF) if (mt->width & 0xF || mt->height & 0xF)
Sys_Error("Texture %s is not 16 aligned", mt); Sys_Error("%s: Texture %s is not 16 aligned", __func__, mt);
pixels = 85 * mt->height * mt->width / 64; pixels = 85 * mt->height * mt->width / 64;
palette = *(uint16*)((char*)mt + sizeof(miptex_t) + pixels); palette = *(uint16*)((char*)mt + sizeof(miptex_t) + pixels);
@ -559,7 +559,7 @@ void Mod_LoadTextures(lump_t *l)
if (max < '0' || max > '9') if (max < '0' || max > '9')
{ {
if (max < 'A' || max > 'J') if (max < 'A' || max > 'J')
Sys_Error("Bad animating texture %s", tx); Sys_Error("%s: Bad animating texture %s", __func__, tx);
altmax = max - 'A'; altmax = max - 'A';
max = 0; max = 0;
altanims[altmax] = tx; altanims[altmax] = tx;
@ -592,7 +592,7 @@ void Mod_LoadTextures(lump_t *l)
if (num < '0' || num > '9') if (num < '0' || num > '9')
{ {
if (num < 'A' || num > 'J') if (num < 'A' || num > 'J')
Sys_Error("Bad animating texture %s", tx); Sys_Error("%s: Bad animating texture %s", __func__, tx);
num -= 'A'; num -= 'A';
altanims[num] = tx2; altanims[num] = tx2;
@ -613,7 +613,7 @@ void Mod_LoadTextures(lump_t *l)
{ {
tx2 = anims[j]; tx2 = anims[j];
if (!tx2) if (!tx2)
Sys_Error("Missing frame %i of %s", j, tx); Sys_Error("%s: Missing frame %i of %s", __func__, j, tx);
tx2->anim_min = j; tx2->anim_min = j;
tx2->anim_total = max; tx2->anim_total = max;
tx2->anim_max = j + 1; tx2->anim_max = j + 1;
@ -626,7 +626,7 @@ void Mod_LoadTextures(lump_t *l)
{ {
tx2 = altanims[j]; tx2 = altanims[j];
if (!tx2) if (!tx2)
Sys_Error("Missing frame %i of %s", j, tx); Sys_Error("%s: Missing frame %i of %s", __func__, j, tx);
tx2->anim_min = j; tx2->anim_min = j;
tx2->anim_total = altmax; tx2->anim_total = altmax;
@ -706,7 +706,7 @@ void Mod_LoadVertexes(lump_t *l)
in = (dvertex_t *)(mod_base + l->fileofs); in = (dvertex_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in)) if (l->filelen % sizeof(*in))
Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); Sys_Error("%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in); count = l->filelen / sizeof(*in);
out = (mvertex_t*) Hunk_AllocName(count * sizeof(*out), loadname); out = (mvertex_t*) Hunk_AllocName(count * sizeof(*out), loadname);
@ -729,7 +729,7 @@ void Mod_LoadSubmodels(lump_t *l)
in = (dmodel_t *)(mod_base + l->fileofs); in = (dmodel_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in)) if (l->filelen % sizeof(*in))
Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); Sys_Error("%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in); count = l->filelen / sizeof(*in);
out = (dmodel_t *)Hunk_AllocName(count*sizeof(*out), loadname); out = (dmodel_t *)Hunk_AllocName(count*sizeof(*out), loadname);
@ -760,7 +760,7 @@ void Mod_LoadEdges(lump_t *l)
in = (dedge_t *)(mod_base + l->fileofs); in = (dedge_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in)) if (l->filelen % sizeof(*in))
Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); Sys_Error("%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in); count = l->filelen / sizeof(*in);
out = (medge_t*) Hunk_AllocName((count + 1) * sizeof(*out), loadname); out = (medge_t*) Hunk_AllocName((count + 1) * sizeof(*out), loadname);
@ -784,7 +784,7 @@ void Mod_LoadTexinfo(lump_t *l)
in = (texinfo_t *)(mod_base + l->fileofs); in = (texinfo_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in)) if (l->filelen % sizeof(*in))
Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); Sys_Error("%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in); count = l->filelen / sizeof(*in);
out = (mtexinfo_t*) Hunk_AllocName(count*sizeof(*out), loadname); out = (mtexinfo_t*) Hunk_AllocName(count*sizeof(*out), loadname);
@ -829,7 +829,7 @@ void Mod_LoadTexinfo(lump_t *l)
else else
{ {
if (_miptex >= loadmodel->numtextures) if (_miptex >= loadmodel->numtextures)
Sys_Error("miptex >= loadmodel->numtextures"); Sys_Error("%s: miptex >= loadmodel->numtextures", __func__);
out->texture = loadmodel->textures[_miptex]; out->texture = loadmodel->textures[_miptex];
if (!out->texture) if (!out->texture)
{ {
@ -882,7 +882,7 @@ void CalcSurfaceExtents(msurface_t *s)
s->texturemins[i] = bmins[i] * 16; s->texturemins[i] = bmins[i] * 16;
s->extents[i] = (bmaxs[i] - bmins[i]) * 16; s->extents[i] = (bmaxs[i] - bmins[i]) * 16;
if (!(tex->flags & TEX_SPECIAL) && s->extents[i] > 256) if (!(tex->flags & TEX_SPECIAL) && s->extents[i] > 256)
Sys_Error("Bad surface extents"); Sys_Error("%s: Bad surface extents", __func__);
} }
} }
@ -895,7 +895,7 @@ void Mod_LoadFaces(lump_t *l)
in = (dface_t *)(mod_base + l->fileofs); in = (dface_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in)) if (l->filelen % sizeof(*in))
Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); Sys_Error("%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in); count = l->filelen / sizeof(*in);
out = (msurface_t *) Hunk_AllocName(count*sizeof(*out), loadname); out = (msurface_t *) Hunk_AllocName(count*sizeof(*out), loadname);
@ -985,7 +985,7 @@ void Mod_LoadNodes(lump_t *l)
in = (dnode_t *)(mod_base + l->fileofs); in = (dnode_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in)) if (l->filelen % sizeof(*in))
Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); Sys_Error("%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in); count = l->filelen / sizeof(*in);
out = (mnode_t*) Hunk_AllocName(count*sizeof(*out), loadname); out = (mnode_t*) Hunk_AllocName(count*sizeof(*out), loadname);
@ -1027,7 +1027,7 @@ void Mod_LoadLeafs(lump_t *l)
in = (dleaf_t *)(mod_base + l->fileofs); in = (dleaf_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in)) if (l->filelen % sizeof(*in))
Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); Sys_Error("%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in); count = l->filelen / sizeof(*in);
out = (mleaf_t*) Hunk_AllocName(count*sizeof(*out), loadname); out = (mleaf_t*) Hunk_AllocName(count*sizeof(*out), loadname);
@ -1041,7 +1041,7 @@ void Mod_LoadLeafs(lump_t *l)
if (row < 0 || row > MODEL_MAX_PVS) if (row < 0 || row > MODEL_MAX_PVS)
{ {
Sys_Error(__FUNCTION__ ": oversized loadmodel->numleafs: %i", loadmodel->numleafs); Sys_Error("%s: oversized loadmodel->numleafs: %i", __func__, loadmodel->numleafs);
} }
} }
#endif #endif
@ -1080,7 +1080,7 @@ void Mod_LoadClipnodes(lump_t *l)
in = (dclipnode_t *)(mod_base + l->fileofs); in = (dclipnode_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in)) if (l->filelen % sizeof(*in))
Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); Sys_Error("%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in); count = l->filelen / sizeof(*in);
out = (dclipnode_t*) Hunk_AllocName(count*sizeof(*out), loadname); out = (dclipnode_t*) Hunk_AllocName(count*sizeof(*out), loadname);
@ -1171,7 +1171,7 @@ void Mod_LoadMarksurfaces(lump_t *l)
in = (short *)(mod_base + l->fileofs); in = (short *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in)) if (l->filelen % sizeof(*in))
Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); Sys_Error("%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in); count = l->filelen / sizeof(*in);
out = (msurface_t **) Hunk_AllocName(count * sizeof(*out), loadname); out = (msurface_t **) Hunk_AllocName(count * sizeof(*out), loadname);
@ -1182,7 +1182,7 @@ void Mod_LoadMarksurfaces(lump_t *l)
{ {
j = LittleShort(in[i]); j = LittleShort(in[i]);
if (j >= loadmodel->numsurfaces) if (j >= loadmodel->numsurfaces)
Sys_Error("Mod_ParseMarksurfaces: bad surface number"); Sys_Error("%s: bad surface number", __func__);
out[i] = loadmodel->surfaces + j; out[i] = loadmodel->surfaces + j;
} }
} }
@ -1194,7 +1194,7 @@ void Mod_LoadSurfedges(lump_t *l)
in = (int *)(mod_base + l->fileofs); in = (int *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in)) if (l->filelen % sizeof(*in))
Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); Sys_Error("%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in); count = l->filelen / sizeof(*in);
out = (int*) Hunk_AllocName(count * sizeof(*out), loadname); out = (int*) Hunk_AllocName(count * sizeof(*out), loadname);
@ -1215,7 +1215,7 @@ void Mod_LoadPlanes(lump_t *l)
in = (dplane_t *)(mod_base + l->fileofs); in = (dplane_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in)) if (l->filelen % sizeof(*in))
Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); Sys_Error("%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in); count = l->filelen / sizeof(*in);
out = (mplane_t*) Hunk_AllocName(count * 2 * sizeof(*out), loadname); out = (mplane_t*) Hunk_AllocName(count * 2 * sizeof(*out), loadname);
@ -1267,7 +1267,7 @@ void EXT_FUNC Mod_LoadBrushModel_internal(model_t *mod, void *buffer)
i = LittleLong(header->version); i = LittleLong(header->version);
if (i != Q1BSP_VERSION && i != HLBSP_VERSION) if (i != Q1BSP_VERSION && i != HLBSP_VERSION)
Sys_Error("Mod_LoadBrushModel: %s has wrong version number (%i should be %i)", mod, i, HLBSP_VERSION); Sys_Error("%s: %s has wrong version number (%i should be %i)", __func__, mod, i, HLBSP_VERSION);
// swap all the lumps // swap all the lumps
mod_base = (byte *)header; mod_base = (byte *)header;
@ -1417,7 +1417,7 @@ void *Mod_LoadAliasGroup(void *pin, int *pframeindex, int numv, trivertx_t *pbbo
*poutintervals = LittleFloat(pin_intervals->interval); *poutintervals = LittleFloat(pin_intervals->interval);
if (*poutintervals <= 0.0f) if (*poutintervals <= 0.0f)
Sys_Error(__FUNCTION__ ": interval<=0"); Sys_Error("%s: interval<=0", __func__);
poutintervals++; poutintervals++;
pin_intervals++; pin_intervals++;
@ -1443,7 +1443,7 @@ void *Mod_LoadAliasSkin(void *pin, int *pskinindex, int skinsize, aliashdr_t *ph
if (r_pixbytes == 1) if (r_pixbytes == 1)
Q_memcpy(pskin, pinskin, skinsize); Q_memcpy(pskin, pinskin, skinsize);
else if (r_pixbytes != 2) else if (r_pixbytes != 2)
Sys_Error(__FUNCTION__ ": driver set invalid r_pixbytes: %d\n", r_pixbytes); Sys_Error("%s: driver set invalid r_pixbytes: %d\n", __func__, r_pixbytes);
return (void *)&pinskin[skinsize]; return (void *)&pinskin[skinsize];
} }
@ -1473,7 +1473,7 @@ void *Mod_LoadAliasSkinGroup(void *pin, int *pskinindex, int skinsize, aliashdr_
*poutskinintervals = LittleFloat(pinskinintervals->interval); *poutskinintervals = LittleFloat(pinskinintervals->interval);
if (*poutskinintervals <= 0.0f) if (*poutskinintervals <= 0.0f)
Sys_Error(__FUNCTION__ ": interval<=0"); Sys_Error("%s: interval<=0", __func__);
poutskinintervals++; poutskinintervals++;
pinskinintervals++; pinskinintervals++;
@ -1514,7 +1514,7 @@ void Mod_LoadAliasModel(model_t *mod, void *buffer)
version = LittleLong(pinmodel->version); version = LittleLong(pinmodel->version);
if (version != ALIAS_MODEL_VERSION) if (version != ALIAS_MODEL_VERSION)
Sys_Error("%s has wrong version number (%i should be %i)", mod->name, version, ALIAS_MODEL_VERSION); Sys_Error("%s: %s has wrong version number (%i should be %i)", __func__, mod->name, version, ALIAS_MODEL_VERSION);
// allocate space for a working header, plus all the data except the frames, // allocate space for a working header, plus all the data except the frames,
// skin and group info // skin and group info
@ -1534,20 +1534,20 @@ void Mod_LoadAliasModel(model_t *mod, void *buffer)
pmodel->skinheight = LittleLong(pinmodel->skinheight); pmodel->skinheight = LittleLong(pinmodel->skinheight);
if (pmodel->skinheight > MAX_LBM_HEIGHT) if (pmodel->skinheight > MAX_LBM_HEIGHT)
Sys_Error("model %s has a skin taller than %d", mod->name, MAX_LBM_HEIGHT); Sys_Error("%s: model %s has a skin taller than %d", __func__, mod->name, MAX_LBM_HEIGHT);
pmodel->numverts = LittleLong(pinmodel->numverts); pmodel->numverts = LittleLong(pinmodel->numverts);
if (pmodel->numverts <= 0) if (pmodel->numverts <= 0)
Sys_Error("model %s has no vertices", mod->name); Sys_Error("%s: model %s has no vertices", __func__, mod->name);
if (pmodel->numverts > MAX_ALIAS_MODEL_VERTS) if (pmodel->numverts > MAX_ALIAS_MODEL_VERTS)
Sys_Error("model %s has too many vertices", mod->name); Sys_Error("%s: model %s has too many vertices", __func__, mod->name);
pmodel->numtris = LittleLong(pinmodel->numtris); pmodel->numtris = LittleLong(pinmodel->numtris);
if (pmodel->numtris <= 0) if (pmodel->numtris <= 0)
Sys_Error("model %s has no triangles", mod->name); Sys_Error("%s: model %s has no triangles", __func__, mod->name);
pmodel->numframes = LittleLong(pinmodel->numframes); pmodel->numframes = LittleLong(pinmodel->numframes);
pmodel->size = LittleFloat(pinmodel->size) * 0.09090909090909091; pmodel->size = LittleFloat(pinmodel->size) * 0.09090909090909091;
@ -1566,7 +1566,7 @@ void Mod_LoadAliasModel(model_t *mod, void *buffer)
numframes = pmodel->numframes; numframes = pmodel->numframes;
if ((pmodel->skinwidth % 4) != 0) if ((pmodel->skinwidth % 4) != 0)
Sys_Error(__FUNCTION__ ": skinwidth not multiple of 4"); Sys_Error("%s: skinwidth not multiple of 4", __func__);
pheader->model = (byte *)pmodel - (byte *)pheader; pheader->model = (byte *)pmodel - (byte *)pheader;
@ -1574,7 +1574,7 @@ void Mod_LoadAliasModel(model_t *mod, void *buffer)
skinsize = pmodel->skinwidth * pmodel->skinheight; skinsize = pmodel->skinwidth * pmodel->skinheight;
if (numskins < 1) if (numskins < 1)
Sys_Error(__FUNCTION__ ": Invalid # of skins: %d\n", numskins); Sys_Error("%s: Invalid # of skins: %d\n", __func__, numskins);
pskintype = (daliasskintype_t *)(pinmodel + 1); pskintype = (daliasskintype_t *)(pinmodel + 1);
pskindesc = (maliasskindesc_t *)Hunk_AllocName(sizeof(maliasskindesc_t) * numskins, loadname); pskindesc = (maliasskindesc_t *)Hunk_AllocName(sizeof(maliasskindesc_t) * numskins, loadname);
@ -1621,7 +1621,7 @@ void Mod_LoadAliasModel(model_t *mod, void *buffer)
// load the frames // load the frames
if (numframes < 1) if (numframes < 1)
Sys_Error(__FUNCTION__ ": Invalid # of frames: %d\n", numframes); Sys_Error("%s: Invalid # of frames: %d\n", __func__, numframes);
pframetype = (daliasframetype_t *)(pintriangles + pmodel->numtris); pframetype = (daliasframetype_t *)(pintriangles + pmodel->numtris);
for (i = 0; i < numframes; i++) for (i = 0; i < numframes; i++)
@ -1715,7 +1715,7 @@ void *Mod_LoadSpriteFrame(void *pin, mspriteframe_t **ppframe)
} }
else else
{ {
Sys_Error("Mod_LoadSpriteFrame: driver set invalid r_pixbytes: %d\n", r_pixbytes); Sys_Error("%s: driver set invalid r_pixbytes: %d\n", __func__, r_pixbytes);
} }
return (void *)((byte *)pinframe + sizeof(dspriteframe_t) + size); return (void *)((byte *)pinframe + sizeof(dspriteframe_t) + size);
@ -1749,7 +1749,7 @@ void *Mod_LoadSpriteGroup(void *pin, mspriteframe_t **ppframe)
{ {
*poutintervals = LittleFloat(pin_intervals->interval); *poutintervals = LittleFloat(pin_intervals->interval);
if (*poutintervals <= 0.0f) if (*poutintervals <= 0.0f)
Sys_Error(__FUNCTION__ ": interval<=0"); Sys_Error("%s: interval<=0", __func__);
poutintervals++; poutintervals++;
pin_intervals++; pin_intervals++;
@ -1779,8 +1779,7 @@ void Mod_LoadSpriteModel(model_t *mod, void *buffer)
version = LittleLong(pin->version); version = LittleLong(pin->version);
if (version != SPRITE_VERSION) if (version != SPRITE_VERSION)
Sys_Error("%s has wrong version number " Sys_Error("%s: %s has wrong version number (%i should be %i)", __func__, mod->name, version, SPRITE_VERSION);
"(%i should be %i)", mod->name, version, SPRITE_VERSION);
numframes = LittleLong(pin->numframes); numframes = LittleLong(pin->numframes);
int palsize = *(uint16*)&pin[1]; int palsize = *(uint16*)&pin[1];
@ -1817,7 +1816,7 @@ void Mod_LoadSpriteModel(model_t *mod, void *buffer)
// load the frames // load the frames
// //
if (numframes < 1) if (numframes < 1)
Sys_Error(__FUNCTION__ ": Invalid # of frames: %d\n", numframes); Sys_Error("%s: Invalid # of frames: %d\n", __func__, numframes);
mod->numframes = numframes; mod->numframes = numframes;
mod->flags = 0; mod->flags = 0;
@ -1916,7 +1915,7 @@ model_t *Mod_Handle(int modelindex)
{ {
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
if (modelindex < 0 || modelindex > MAX_MODELS - 1) { if (modelindex < 0 || modelindex > MAX_MODELS - 1) {
Sys_Error(__FUNCTION__ ": bad modelindex #%i\n", modelindex); Sys_Error("%s: bad modelindex #%i\n", __func__, modelindex);
} }
#endif #endif

View File

@ -62,7 +62,7 @@ void Netchan_UnlinkFragment(fragbuf_t *buf, fragbuf_t **list)
if (list == nullptr) if (list == nullptr)
{ {
Con_Printf(__FUNCTION__ ": Asked to unlink fragment from empty list, ignored\n"); Con_Printf("%s: Asked to unlink fragment from empty list, ignored\n", __func__);
return; return;
} }
@ -85,7 +85,7 @@ void Netchan_UnlinkFragment(fragbuf_t *buf, fragbuf_t **list)
search = search->next; search = search->next;
} }
Con_Printf(__FUNCTION__ ": Couldn't find fragment\n"); Con_Printf("%s: Couldn't find fragment\n", __func__);
} }
void Netchan_OutOfBand(netsrc_t sock, netadr_t adr, int length, byte *data) void Netchan_OutOfBand(netsrc_t sock, netadr_t adr, int length, byte *data)
@ -167,7 +167,7 @@ void Netchan_Clear(netchan_t *chan)
if (chan->reliable_length) if (chan->reliable_length)
{ {
Con_DPrintf(__FUNCTION__ ": reliable length not 0, reliable_sequence: %d, incoming_reliable_acknowledged: %d\n", chan->reliable_length, chan->incoming_reliable_acknowledged); Con_DPrintf("%s: reliable length not 0, reliable_sequence: %d, incoming_reliable_acknowledged: %d\n", __func__, chan->reliable_length, chan->incoming_reliable_acknowledged);
chan->reliable_sequence ^= 1; chan->reliable_sequence ^= 1;
chan->reliable_length = 0; chan->reliable_length = 0;
} }
@ -1157,7 +1157,7 @@ void Netchan_CreateFileFragmentsFromBuffer(qboolean server, netchan_t *chan, con
if (server) if (server)
SV_DropClient(host_client, 0, "Malloc problem"); SV_DropClient(host_client, 0, "Malloc problem");
else else
rehlds_syserror(__FUNCTION__ "Reverse me: client-side code"); rehlds_syserror("%s:Reverse me: client-side code", __func__);
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
if (bCompressed) { if (bCompressed) {
@ -1357,7 +1357,7 @@ int Netchan_CreateFileFragments_(qboolean server, netchan_t *chan, const char *f
} }
else else
{ {
rehlds_syserror(__FUNCTION__ ": Reverse clientside code"); rehlds_syserror("%s: Reverse clientside code", __func__);
return 0; return 0;
} }
} }

View File

@ -589,7 +589,7 @@ void NET_TransferRawData(sizebuf_t *msg, unsigned char *pStart, int nSize)
#ifdef REHLDS_CHECKS #ifdef REHLDS_CHECKS
if (msg->maxsize < nSize) if (msg->maxsize < nSize)
{ {
Sys_Error(__FUNCTION__ ": data size is bigger than sizebuf maxsize"); Sys_Error("%s: data size is bigger than sizebuf maxsize", __func__);
} }
#endif // REHLDS_CHECKS #endif // REHLDS_CHECKS
Q_memcpy(msg->data, pStart, nSize); Q_memcpy(msg->data, pStart, nSize);
@ -638,7 +638,7 @@ void NET_SendLoopPacket(netsrc_t sock, int length, void *data, const netadr_t& t
#ifdef REHLDS_CHECKS #ifdef REHLDS_CHECKS
if (sizeof(loop->msgs[i].data) < length) if (sizeof(loop->msgs[i].data) < length)
{ {
Sys_Error(__FUNCTION__ ": data size is bigger than message storage size"); Sys_Error("%s: data size is bigger than message storage size", __func__);
} }
#endif // REHLDS_CHECKS #endif // REHLDS_CHECKS
@ -1000,14 +1000,15 @@ qboolean NET_QueuePacket(netsrc_t sock)
{ {
if (err == WSAEMSGSIZE) if (err == WSAEMSGSIZE)
{ {
Con_DPrintf("NET_QueuePacket: Ignoring oversized network message\n"); Con_DPrintf("%s: Ignoring oversized network message\n", __func__);
} }
else else
{ {
if (g_pcls.state != ca_dedicated) if (g_pcls.state != ca_dedicated)
Sys_Error("NET_QueuePacket: %s", NET_ErrorString(err)); {
else Sys_Error("%s: %s", __func__, NET_ErrorString(err));
Con_Printf("NET_QueuePacket: %s\n", NET_ErrorString(err)); }
Con_Printf("%s: %s\n", __func__, NET_ErrorString(err));
} }
} }
continue; continue;
@ -1017,7 +1018,7 @@ qboolean NET_QueuePacket(netsrc_t sock)
if (ret != MAX_UDP_PACKET) if (ret != MAX_UDP_PACKET)
break; break;
Con_NetPrintf("NET_QueuePacket: Oversize packet from %s\n", NET_AdrToString(in_from)); Con_NetPrintf("%s: Oversize packet from %s\n", __func__, NET_AdrToString(in_from));
} }
if (ret == -1 || ret == MAX_UDP_PACKET) { if (ret == -1 || ret == MAX_UDP_PACKET) {
@ -1173,7 +1174,7 @@ void NET_StartThread(void)
if (!net_thread_initialized) if (!net_thread_initialized)
{ {
net_thread_initialized = TRUE; net_thread_initialized = TRUE;
Sys_Error("-net_thread is not reversed yet"); Sys_Error("%s: -net_thread is not reversed yet", __func__);
#ifdef _WIN32 #ifdef _WIN32
/* /*
InitializeCriticalSection(&net_cs); InitializeCriticalSection(&net_cs);
@ -1183,7 +1184,7 @@ void NET_StartThread(void)
DeleteCriticalSection(&net_cs); DeleteCriticalSection(&net_cs);
net_thread_initialized = 0; net_thread_initialized = 0;
use_thread = 0; use_thread = 0;
Sys_Error("Couldn't initialize network thread, run without -net_thread\n"); Sys_Error("%s: Couldn't initialize network thread, run without -net_thread\n", __func__);
} }
*/ */
#endif // _WIN32 #endif // _WIN32
@ -1204,7 +1205,7 @@ void NET_StopThread(void)
*/ */
#endif // _WIN32 #endif // _WIN32
net_thread_initialized = FALSE; net_thread_initialized = FALSE;
Sys_Error("-net_thread is not reversed yet"); Sys_Error("%s: -net_thread is not reversed yet", __func__);
} }
} }
} }
@ -1471,7 +1472,7 @@ void NET_SendPacket(netsrc_t sock, int length, void *data, const netadr_t& to)
#endif // _WIN32 #endif // _WIN32
else else
{ {
Sys_Error(__FUNCTION__ ": bad address type"); Sys_Error("%s: bad address type", __func__);
} }
NetadrToSockadr(&to, &addr); NetadrToSockadr(&to, &addr);
@ -1499,17 +1500,17 @@ void NET_SendPacket(netsrc_t sock, int length, void *data, const netadr_t& to)
// let dedicated servers continue after errors // let dedicated servers continue after errors
if (g_pcls.state == ca_dedicated) if (g_pcls.state == ca_dedicated)
{ {
Con_Printf(__FUNCTION__ " ERROR: %s\n", NET_ErrorString(err)); Con_Printf("%s: ERROR: %s\n", __func__, NET_ErrorString(err));
} }
else else
{ {
if (err == WSAEADDRNOTAVAIL || err == WSAENOBUFS) if (err == WSAEADDRNOTAVAIL || err == WSAENOBUFS)
{ {
Con_DPrintf(__FUNCTION__ " Warning: %s : %s\n", NET_ErrorString(err), NET_AdrToString(to)); Con_DPrintf("%s: Warning: %s : %s\n", __func__, NET_ErrorString(err), NET_AdrToString(to));
} }
else else
{ {
Sys_Error(__FUNCTION__ " ERROR: %s\n", NET_ErrorString(err)); Sys_Error("%s: ERROR: %s\n", __func__, NET_ErrorString(err));
} }
} }
} }
@ -1672,7 +1673,7 @@ void NET_OpenIP(void)
if (!ip_sockets[NS_SERVER] && dedicated) if (!ip_sockets[NS_SERVER] && dedicated)
#endif #endif
{ {
Sys_Error("Couldn't allocate dedicated server IP port %d.", port); Sys_Error("%s: Couldn't allocate dedicated server IP port %d.", __func__, port);
} }
sv_port = port; sv_port = port;
} }

View File

@ -113,7 +113,7 @@ int EXT_FUNC PM_HullPointContents(hull_t *hull, int num, vec_t *p)
while (num >= 0) while (num >= 0)
{ {
if (num < hull->firstclipnode || num > hull->lastclipnode) if (num < hull->firstclipnode || num > hull->lastclipnode)
Sys_Error("PM_HullPointContents: bad node number"); Sys_Error("%s: bad node number", __func__);
node = &hull->clipnodes[num]; node = &hull->clipnodes[num];
plane = &hull->planes[node->planenum]; plane = &hull->planes[node->planenum];

View File

@ -99,7 +99,7 @@ void EXT_FUNC SetMinMaxSize(edict_t *e, const float *min, const float *max, qboo
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
if (min[i] > max[i]) if (min[i] > max[i])
Host_Error("backwards mins/maxs"); Host_Error("%s: backwards mins/maxs", __func__);
} }
e->v.mins[0] = min[0]; e->v.mins[0] = min[0];
@ -161,7 +161,7 @@ void EXT_FUNC PF_setmodel_I(edict_t *e, const char *m)
} }
} }
Host_Error("no precache: %s\n", m); Host_Error("%s: no precache: %s\n", __func__, m);
} }
int EXT_FUNC PF_modelindex(const char *pstr) int EXT_FUNC PF_modelindex(const char *pstr)
@ -324,13 +324,13 @@ void EXT_FUNC PF_ambientsound_I(edict_t *entity, float *pos, const char *samp, f
void EXT_FUNC PF_sound_I(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch) void EXT_FUNC PF_sound_I(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch)
{ {
if (volume < 0.0 || volume > 255.0) if (volume < 0.0 || volume > 255.0)
Sys_Error("EMIT_SOUND: volume = %i", volume); Sys_Error("%s: volume = %i", __func__, volume);
if (attenuation < 0.0 || attenuation > 4.0) if (attenuation < 0.0 || attenuation > 4.0)
Sys_Error("EMIT_SOUND: attenuation = %f", attenuation); Sys_Error("%s: attenuation = %f", __func__, attenuation);
if (channel < 0 || channel > 7) if (channel < 0 || channel > 7)
Sys_Error("EMIT_SOUND: channel = %i", channel); Sys_Error("%s: channel = %i", __func__, channel);
if (pitch < 0 || pitch > 255) if (pitch < 0 || pitch > 255)
Sys_Error("EMIT_SOUND: pitch = %i", pitch); Sys_Error("%s: pitch = %i", __func__, pitch);
SV_StartSound(0, entity, channel, sample, (int)(volume * 255), attenuation, fFlags, pitch); SV_StartSound(0, entity, channel, sample, (int)(volume * 255), attenuation, fFlags, pitch);
} }
@ -390,7 +390,7 @@ void EXT_FUNC TraceHull(const float *v1, const float *v2, int fNoMonsters, int h
void EXT_FUNC TraceSphere(const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr) void EXT_FUNC TraceSphere(const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr)
{ {
Sys_Error("TraceSphere not yet implemented!\n"); Sys_Error("%s: TraceSphere not yet implemented!\n", __func__);
} }
void EXT_FUNC TraceModel(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr) void EXT_FUNC TraceModel(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr)
@ -906,7 +906,7 @@ edict_t* EXT_FUNC CreateNamedEntity(int className)
ENTITYINIT pEntityInit; ENTITYINIT pEntityInit;
if (!className) if (!className)
Sys_Error("Spawned a NULL entity!"); Sys_Error("%s: Spawned a NULL entity!", __func__);
pedict = ED_Alloc(); pedict = ED_Alloc();
pedict->v.classname = className; pedict->v.classname = className;
@ -1020,13 +1020,13 @@ int EXT_FUNC PF_precache_sound_I(const char *s)
int i; int i;
if (!s) if (!s)
Host_Error(__FUNCTION__ ": NULL pointer"); Host_Error("%s: NULL pointer", __func__);
if (PR_IsEmptyString(s)) if (PR_IsEmptyString(s))
Host_Error(__FUNCTION__ ": Bad string '%s'", s); Host_Error("%s: Bad string '%s'", __func__, s);
if (s[0] == '!') if (s[0] == '!')
Host_Error(__FUNCTION__ ": '%s' do not precache sentence names!", s); Host_Error("%s: '%s' do not precache sentence names!", __func__, s);
if (g_psv.state == ss_loading) if (g_psv.state == ss_loading)
{ {
@ -1049,8 +1049,8 @@ int EXT_FUNC PF_precache_sound_I(const char *s)
return i; return i;
} }
Host_Error(__FUNCTION__ ": Sound '%s' failed to precache because the item count is over the %d limit.\n" Host_Error("%s: Sound '%s' failed to precache because the item count is over the %d limit.\n"
"Reduce the number of brush models and/or regular models in the map to correct this.", "Reduce the number of brush models and/or regular models in the map to correct this.", __func__,
s, MAX_SOUNDS); s, MAX_SOUNDS);
} }
else else
@ -1062,7 +1062,7 @@ int EXT_FUNC PF_precache_sound_I(const char *s)
return i; return i;
} }
Host_Error(__FUNCTION__ ": '%s' Precache can only be done in spawn functions", s); Host_Error("%s: '%s' Precache can only be done in spawn functions", __func__, s);
} }
// unreach // unreach
@ -1072,10 +1072,10 @@ int EXT_FUNC PF_precache_sound_I(const char *s)
unsigned short EXT_FUNC EV_Precache(int type, const char *psz) unsigned short EXT_FUNC EV_Precache(int type, const char *psz)
{ {
if (!psz) if (!psz)
Host_Error(__FUNCTION__ ": NULL pointer"); Host_Error("%s: NULL pointer", __func__);
if (PR_IsEmptyString(psz)) if (PR_IsEmptyString(psz))
Host_Error(__FUNCTION__ ": Bad string '%s'", psz); Host_Error("%s: Bad string '%s'", __func__, psz);
if (g_psv.state == ss_loading) if (g_psv.state == ss_loading)
{ {
@ -1085,7 +1085,7 @@ unsigned short EXT_FUNC EV_Precache(int type, const char *psz)
if (!ev->filename) if (!ev->filename)
{ {
if (type != 1) if (type != 1)
Host_Error(__FUNCTION__ ": only file type 1 supported currently\n"); Host_Error("%s: only file type 1 supported currently\n", __func__);
char szpath[MAX_PATH]; char szpath[MAX_PATH];
Q_snprintf(szpath, sizeof(szpath), "%s", psz); Q_snprintf(szpath, sizeof(szpath), "%s", psz);
@ -1094,7 +1094,7 @@ unsigned short EXT_FUNC EV_Precache(int type, const char *psz)
int scriptSize = 0; int scriptSize = 0;
char* evScript = (char*) COM_LoadFile(szpath, 5, &scriptSize); char* evScript = (char*) COM_LoadFile(szpath, 5, &scriptSize);
if (!evScript) if (!evScript)
Host_Error(__FUNCTION__ ": file %s missing from server\n", psz); Host_Error("%s: file %s missing from server\n", __func__, psz);
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
// Many modders don't know that the resource names passed to precache functions must be a static strings. // Many modders don't know that the resource names passed to precache functions must be a static strings.
// Also some metamod modules can be unloaded during the server running. // Also some metamod modules can be unloaded during the server running.
@ -1114,7 +1114,7 @@ unsigned short EXT_FUNC EV_Precache(int type, const char *psz)
if (!Q_stricmp(ev->filename, psz)) if (!Q_stricmp(ev->filename, psz))
return i; return i;
} }
Host_Error(__FUNCTION__ ": '%s' overflow", psz); Host_Error("%s: '%s' overflow", __func__, psz);
} }
else else
{ {
@ -1125,7 +1125,7 @@ unsigned short EXT_FUNC EV_Precache(int type, const char *psz)
return i; return i;
} }
Host_Error(__FUNCTION__ ": '%s' Precache can only be done in spawn functions", psz); Host_Error("%s: '%s' Precache can only be done in spawn functions", __func__, psz);
} }
} }
@ -1218,13 +1218,13 @@ void EXT_FUNC EV_Playback(int flags, const edict_t *pInvoker, unsigned short eve
if (eventindex < 1u || eventindex >= MAX_EVENTS) if (eventindex < 1u || eventindex >= MAX_EVENTS)
{ {
Con_DPrintf(__FUNCTION__ ": index out of range %i\n", eventindex); Con_DPrintf("%s: index out of range %i\n", __func__, eventindex);
return; return;
} }
if (!g_psv.event_precache[eventindex].pszScript) if (!g_psv.event_precache[eventindex].pszScript)
{ {
Con_DPrintf(__FUNCTION__ ": no event for index %i\n", eventindex); Con_DPrintf("%s: no event for index %i\n", __func__, eventindex);
return; return;
} }
@ -1355,7 +1355,7 @@ void EXT_FUNC EV_SV_Playback(int flags, int clientindex, unsigned short eventind
return; return;
if (clientindex < 0 || clientindex >= g_psvs.maxclients) if (clientindex < 0 || clientindex >= g_psvs.maxclients)
Host_Error(__FUNCTION__ ": Client index %i out of range\n", clientindex); Host_Error("%s: Client index %i out of range\n", __func__, clientindex);
edict_t *pEdict = g_psvs.clients[clientindex].edict; edict_t *pEdict = g_psvs.clients[clientindex].edict;
EV_Playback(flags,pEdict, eventindex, delay, origin, angles, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2); EV_Playback(flags,pEdict, eventindex, delay, origin, angles, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2);
@ -1391,10 +1391,10 @@ int EXT_FUNC PF_precache_model_I(const char *s)
{ {
int iOptional = 0; int iOptional = 0;
if (!s) if (!s)
Host_Error(__FUNCTION__ ": NULL pointer"); Host_Error("%s: NULL pointer", __func__);
if (PR_IsEmptyString(s)) if (PR_IsEmptyString(s))
Host_Error(__FUNCTION__ ": Bad string '%s'", s); Host_Error("%s: Bad string '%s'", __func__, s);
if (*s == '!') if (*s == '!')
{ {
@ -1435,8 +1435,8 @@ int EXT_FUNC PF_precache_model_I(const char *s)
return i; return i;
#endif #endif
} }
Host_Error(__FUNCTION__ ": Model '%s' failed to precache because the item count is over the %d limit.\n" Host_Error("%s: Model '%s' failed to precache because the item count is over the %d limit.\n"
"Reduce the number of brush models and/or regular models in the map to correct this.", "Reduce the number of brush models and/or regular models in the map to correct this.", __func__,
s, MAX_MODELS); s, MAX_MODELS);
} }
else else
@ -1452,7 +1452,7 @@ int EXT_FUNC PF_precache_model_I(const char *s)
return i; return i;
#endif #endif
} }
Host_Error(__FUNCTION__ ": '%s' Precache can only be done in spawn functions", s); Host_Error("%s: '%s' Precache can only be done in spawn functions", __func__, s);
} }
} }
@ -1460,12 +1460,12 @@ int EXT_FUNC PF_precache_model_I(const char *s)
int EXT_FUNC PF_precache_generic_I(char *s) int EXT_FUNC PF_precache_generic_I(char *s)
{ {
if (!s) if (!s)
Host_Error(__FUNCTION__ ": NULL pointer"); Host_Error("%s: NULL pointer", __func__);
if (PR_IsEmptyString(s)) if (PR_IsEmptyString(s))
{ {
// TODO: Call to Con_Printf is replaced with Host_Error in 6153 // TODO: Call to Con_Printf is replaced with Host_Error in 6153
Host_Error(__FUNCTION__ ": Bad string '%s'", s); Host_Error("%s: Bad string '%s'", __func__, s);
} }
char resName[MAX_QPATH]; char resName[MAX_QPATH];
@ -1490,12 +1490,12 @@ int EXT_FUNC PF_precache_generic_I(char *s)
} }
if (g_psv.state != ss_loading) if (g_psv.state != ss_loading)
Host_Error(__FUNCTION__ ": '%s' Precache can only be done in spawn functions", resName); Host_Error("%s: '%s' Precache can only be done in spawn functions", __func__, resName);
if (resCount >= ARRAYSIZE(g_rehlds_sv.precachedGenericResourceNames)) if (resCount >= ARRAYSIZE(g_rehlds_sv.precachedGenericResourceNames))
{ {
Host_Error(__FUNCTION__ ": Generic item '%s' failed to precache because the item count is over the %d limit.\n" Host_Error("%s: Generic item '%s' failed to precache because the item count is over the %d limit.\n"
"Reduce the number of brush models and/or regular models in the map to correct this.", "Reduce the number of brush models and/or regular models in the map to correct this.", __func__,
resName, ARRAYSIZE(g_rehlds_sv.precachedGenericResourceNames)); resName, ARRAYSIZE(g_rehlds_sv.precachedGenericResourceNames));
} }
@ -1507,12 +1507,12 @@ int EXT_FUNC PF_precache_generic_I(char *s)
int EXT_FUNC PF_precache_generic_I(char *s) int EXT_FUNC PF_precache_generic_I(char *s)
{ {
if (!s) if (!s)
Host_Error(__FUNCTION__ ": NULL pointer"); Host_Error("%s: NULL pointer", __func__);
if (PR_IsEmptyString(s)) if (PR_IsEmptyString(s))
{ {
// TODO: Call to Con_Printf is replaced with Host_Error in 6153 // TODO: Call to Con_Printf is replaced with Host_Error in 6153
Host_Error(__FUNCTION__ ": Bad string '%s'", s); Host_Error("%s: Bad string '%s'", __func__, s);
} }
if (g_psv.state == ss_loading) if (g_psv.state == ss_loading)
@ -1528,8 +1528,8 @@ int EXT_FUNC PF_precache_generic_I(char *s)
if (!Q_stricmp(g_psv.generic_precache[i], s)) if (!Q_stricmp(g_psv.generic_precache[i], s))
return i; return i;
} }
Host_Error(__FUNCTION__ ": Generic item '%s' failed to precache because the item count is over the %d limit.\n" Host_Error("%s: Generic item '%s' failed to precache because the item count is over the %d limit.\n"
"Reduce the number of brush models and/or regular models in the map to correct this.", "Reduce the number of brush models and/or regular models in the map to correct this.", __func__,
s, MAX_GENERIC); s, MAX_GENERIC);
} }
else else
@ -1539,7 +1539,7 @@ int EXT_FUNC PF_precache_generic_I(char *s)
if (!Q_stricmp(g_psv.generic_precache[i], s)) if (!Q_stricmp(g_psv.generic_precache[i], s))
return i; return i;
} }
Host_Error(__FUNCTION__ ": '%s' Precache can only be done in spawn functions", s); Host_Error("%s: '%s' Precache can only be done in spawn functions", __func__, s);
} }
} }
#endif // REHLDS_FIXES #endif // REHLDS_FIXES
@ -1614,7 +1614,7 @@ void EXT_FUNC PF_SetKeyValue_I(char *infobuffer, const char *key, const char *va
{ {
if (infobuffer != Info_Serverinfo()) if (infobuffer != Info_Serverinfo())
{ {
Sys_Error("Can't set client keys with SetKeyValue"); Sys_Error("%s: Can't set client keys with SetKeyValue", __func__);
} }
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
Info_SetValueForKey(infobuffer, key, value, MAX_INFO_STRING); // Use correct length Info_SetValueForKey(infobuffer, key, value, MAX_INFO_STRING); // Use correct length
@ -1906,7 +1906,7 @@ void EXT_FUNC PF_setview_I(const edict_t *clientent, const edict_t *viewent)
{ {
int clientnum = NUM_FOR_EDICT(clientent); int clientnum = NUM_FOR_EDICT(clientent);
if (clientnum < 1 || clientnum > g_psvs.maxclients) if (clientnum < 1 || clientnum > g_psvs.maxclients)
Host_Error("PF_setview_I: not a client"); Host_Error("%s: not a client", __func__);
client_t *client = &g_psvs.clients[clientnum - 1]; client_t *client = &g_psvs.clients[clientnum - 1];
if (!client->fakeclient) if (!client->fakeclient)
@ -2049,7 +2049,7 @@ sizebuf_t* EXT_FUNC WriteDest_Parm(int dest)
entnum = NUM_FOR_EDICT(gMsgEntity); entnum = NUM_FOR_EDICT(gMsgEntity);
if (entnum <= 0 || entnum > g_psvs.maxclients) if (entnum <= 0 || entnum > g_psvs.maxclients)
{ {
Host_Error("WriteDest_Parm: not a client"); Host_Error("%s: not a client", __func__);
} }
if (dest == MSG_ONE) if (dest == MSG_ONE)
{ {
@ -2069,7 +2069,7 @@ sizebuf_t* EXT_FUNC WriteDest_Parm(int dest)
case MSG_SPEC: case MSG_SPEC:
return &g_psv.spectator; return &g_psv.spectator;
default: default:
Host_Error("WriteDest_Parm: bad destination=%d", dest); Host_Error("%s: bad destination = %d", __func__, dest);
} }
} }
@ -2078,19 +2078,19 @@ void EXT_FUNC PF_MessageBegin_I(int msg_dest, int msg_type, const float *pOrigin
if (msg_dest == MSG_ONE || msg_dest == MSG_ONE_UNRELIABLE) if (msg_dest == MSG_ONE || msg_dest == MSG_ONE_UNRELIABLE)
{ {
if (!ed) if (!ed)
Sys_Error("MSG_ONE or MSG_ONE_UNRELIABLE with no target entity\n"); Sys_Error("%s: with no target entity\n", __func__);
} }
else else
{ {
if (ed) if (ed)
Sys_Error("Invalid message; cannot use broadcast message with a target entity"); Sys_Error("%s: Invalid message: Cannot use broadcast message with a target entity", __func__);
} }
if (gMsgStarted) if (gMsgStarted)
Sys_Error("New message started when msg '%d' has not been sent yet", gMsgType); Sys_Error("%s: New message started when msg '%d' has not been sent yet", __func__, gMsgType);
if (msg_type == 0) if (msg_type == 0)
Sys_Error("Tried to create a message with a bogus message type ( 0 )"); Sys_Error("%s: Tried to create a message with a bogus message type ( 0 )", __func__);
gMsgStarted = 1; gMsgStarted = 1;
gMsgType = msg_type; gMsgType = msg_type;
@ -2117,14 +2117,14 @@ void EXT_FUNC PF_MessageEnd_I(void)
{ {
qboolean MsgIsVarLength = 0; qboolean MsgIsVarLength = 0;
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error("MESSAGE_END called with no active message\n"); Sys_Error("%s: called with no active message\n", __func__);
gMsgStarted = 0; gMsgStarted = 0;
if (gMsgEntity && (gMsgEntity->v.flags & FL_FAKECLIENT)) if (gMsgEntity && (gMsgEntity->v.flags & FL_FAKECLIENT))
return; return;
if (gMsgBuffer.flags & SIZEBUF_OVERFLOWED) if (gMsgBuffer.flags & SIZEBUF_OVERFLOWED)
Sys_Error("MESSAGE_END called, but message buffer from .dll had overflowed\n"); Sys_Error("%s: called, but message buffer from .dll had overflowed\n", __func__);
if (gMsgType > svc_startofusermessages) if (gMsgType > svc_startofusermessages)
@ -2142,7 +2142,7 @@ void EXT_FUNC PF_MessageEnd_I(void)
if (!pUserMsg) if (!pUserMsg)
{ {
Con_DPrintf("PF_MessageEnd_I: Unknown User Msg %d\n", gMsgType); Con_DPrintf("%s: Unknown User Msg %d\n", __func__, gMsgType);
return; return;
} }
@ -2152,22 +2152,12 @@ void EXT_FUNC PF_MessageEnd_I(void)
// Limit packet sizes // Limit packet sizes
if (gMsgBuffer.cursize > MAX_USER_MSG_DATA) if (gMsgBuffer.cursize > MAX_USER_MSG_DATA)
Host_Error( Host_Error("%s: Refusing to send user message %s of %i bytes to client, user message size limit is %i bytes\n", __func__, pUserMsg->szName, gMsgBuffer.cursize, MAX_USER_MSG_DATA);
"PF_MessageEnd_I: Refusing to send user message %s of %i bytes to client, user message size limit is %i bytes\n",
pUserMsg->szName,
gMsgBuffer.cursize,
MAX_USER_MSG_DATA
);
} }
else else
{ {
if (pUserMsg->iSize != gMsgBuffer.cursize) if (pUserMsg->iSize != gMsgBuffer.cursize)
Sys_Error( Sys_Error("%s: User Msg '%s': %d bytes written, expected %d\n", __func__, pUserMsg->szName, gMsgBuffer.cursize, pUserMsg->iSize);
"User Msg '%s': %d bytes written, expected %d\n",
pUserMsg->szName,
gMsgBuffer.cursize,
pUserMsg->iSize
);
} }
} }
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
@ -2182,7 +2172,7 @@ void EXT_FUNC PF_MessageEnd_I(void)
{ {
int entnum = NUM_FOR_EDICT((const edict_t *)gMsgEntity); int entnum = NUM_FOR_EDICT((const edict_t *)gMsgEntity);
if (entnum < 1 || entnum > g_psvs.maxclients) if (entnum < 1 || entnum > g_psvs.maxclients)
Host_Error("WriteDest_Parm: not a client"); Host_Error("%s: not a client", __func__);
client_t* client = &g_psvs.clients[entnum - 1]; client_t* client = &g_psvs.clients[entnum - 1];
if (client->fakeclient || !client->hasusrmsgs || (!client->active && !client->spawned)) if (client->fakeclient || !client->hasusrmsgs || (!client->active && !client->spawned))
@ -2197,9 +2187,11 @@ void EXT_FUNC PF_MessageEnd_I(void)
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
; ;
if (gMsgDest == MSG_ALL) { if (gMsgDest == MSG_ALL)
{
gMsgDest = MSG_ONE; gMsgDest = MSG_ONE;
for (int i = 0; i < g_psvs.maxclients; i++) { for (int i = 0; i < g_psvs.maxclients; i++)
{
gMsgEntity = g_psvs.clients[i].edict; gMsgEntity = g_psvs.clients[i].edict;
if (gMsgEntity == nullptr) if (gMsgEntity == nullptr)
continue; continue;
@ -2207,7 +2199,9 @@ void EXT_FUNC PF_MessageEnd_I(void)
continue; continue;
writer(); writer();
} }
} else { }
else
{
writer(); writer();
} }
#endif #endif
@ -2238,56 +2232,56 @@ void EXT_FUNC PF_MessageEnd_I(void)
void EXT_FUNC PF_WriteByte_I(int iValue) void EXT_FUNC PF_WriteByte_I(int iValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n"); Sys_Error("%s: called with no active message\n", __func__);
MSG_WriteByte(&gMsgBuffer, iValue); MSG_WriteByte(&gMsgBuffer, iValue);
} }
void EXT_FUNC PF_WriteChar_I(int iValue) void EXT_FUNC PF_WriteChar_I(int iValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n"); Sys_Error("%s: called with no active message\n", __func__);
MSG_WriteChar(&gMsgBuffer, iValue); MSG_WriteChar(&gMsgBuffer, iValue);
} }
void EXT_FUNC PF_WriteShort_I(int iValue) void EXT_FUNC PF_WriteShort_I(int iValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n"); Sys_Error("%s: called with no active message\n", __func__);
MSG_WriteShort(&gMsgBuffer, iValue); MSG_WriteShort(&gMsgBuffer, iValue);
} }
void EXT_FUNC PF_WriteLong_I(int iValue) void EXT_FUNC PF_WriteLong_I(int iValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n"); Sys_Error("%s: called with no active message\n", __func__);
MSG_WriteLong(&gMsgBuffer, iValue); MSG_WriteLong(&gMsgBuffer, iValue);
} }
void EXT_FUNC PF_WriteAngle_I(float flValue) void EXT_FUNC PF_WriteAngle_I(float flValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n"); Sys_Error("%s: called with no active message\n", __func__);
MSG_WriteAngle(&gMsgBuffer, flValue); MSG_WriteAngle(&gMsgBuffer, flValue);
} }
void EXT_FUNC PF_WriteCoord_I(float flValue) void EXT_FUNC PF_WriteCoord_I(float flValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n"); Sys_Error("%s: called with no active message\n", __func__);
MSG_WriteShort(&gMsgBuffer, (int)(flValue * 8.0)); MSG_WriteShort(&gMsgBuffer, (int)(flValue * 8.0));
} }
void EXT_FUNC PF_WriteString_I(const char *sz) void EXT_FUNC PF_WriteString_I(const char *sz)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n"); Sys_Error("%s: called with no active message\n", __func__);
MSG_WriteString(&gMsgBuffer, sz); MSG_WriteString(&gMsgBuffer, sz);
} }
void EXT_FUNC PF_WriteEntity_I(int iValue) void EXT_FUNC PF_WriteEntity_I(int iValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n"); Sys_Error("%s: called with no active message\n", __func__);
MSG_WriteShort(&gMsgBuffer, iValue); MSG_WriteShort(&gMsgBuffer, iValue);
} }
@ -2337,7 +2331,7 @@ void EXT_FUNC PF_setspawnparms_I(edict_t *ent)
{ {
int i = NUM_FOR_EDICT(ent); int i = NUM_FOR_EDICT(ent);
if (i < 1 || i > g_psvs.maxclients) if (i < 1 || i > g_psvs.maxclients)
Host_Error("Entity is not a client"); Host_Error("%s: Entity is not a client", __func__);
} }
void EXT_FUNC PF_changelevel_I(const char *s1, const char *s2) void EXT_FUNC PF_changelevel_I(const char *s1, const char *s2)
@ -2652,10 +2646,10 @@ void EXT_FUNC PF_ForceUnmodified(FORCE_TYPE type, float *mins, float *maxs, cons
int i; int i;
if (!filename) if (!filename)
Host_Error(__FUNCTION__ ": NULL pointer"); Host_Error("%s: NULL pointer", __func__);
if (PR_IsEmptyString(filename)) if (PR_IsEmptyString(filename))
Host_Error(__FUNCTION__ ": Bad string '%s'", filename); Host_Error("%s: Bad string '%s'", __func__, filename);
if (g_psv.state == ss_loading) if (g_psv.state == ss_loading)
{ {
@ -2670,7 +2664,7 @@ void EXT_FUNC PF_ForceUnmodified(FORCE_TYPE type, float *mins, float *maxs, cons
++i; ++i;
if (i >= 512) if (i >= 512)
Host_Error(__FUNCTION__ ": '%s' overflow", filename); Host_Error("%s: '%s' overflow", __func__, filename);
} }
cnode->check_type = type; cnode->check_type = type;
@ -2697,7 +2691,7 @@ void EXT_FUNC PF_ForceUnmodified(FORCE_TYPE type, float *mins, float *maxs, cons
++cnode; ++cnode;
++i; ++i;
if (i >= 512) if (i >= 512)
Host_Error(__FUNCTION__ ": '%s' Precache can only be done in spawn functions", filename); Host_Error("%s: '%s' Precache can only be done in spawn functions", __func__, filename);
} }
} }
} }

View File

@ -57,9 +57,9 @@ edict_t *ED_Alloc(void)
{ {
if (!g_psv.max_edicts) if (!g_psv.max_edicts)
{ {
Sys_Error(__FUNCTION__ ": no edicts yet"); Sys_Error("%s: no edicts yet", __func__);
} }
Sys_Error(__FUNCTION__ ": no free edicts"); Sys_Error("%s: no free edicts", __func__);
} }
// Use new one // Use new one
@ -221,7 +221,7 @@ char *ED_ParseEdict(char *data, edict_t *ent)
} }
if (!data) if (!data)
{ {
Host_Error(__FUNCTION__ ": EOF without closing brace"); Host_Error("%s: EOF without closing brace", __func__);
} }
Q_strncpy(keyname, com_token, ARRAYSIZE(keyname) - 1); Q_strncpy(keyname, com_token, ARRAYSIZE(keyname) - 1);
@ -235,11 +235,11 @@ char *ED_ParseEdict(char *data, edict_t *ent)
data = COM_Parse(data); data = COM_Parse(data);
if (!data) if (!data)
{ {
Host_Error(__FUNCTION__ ": EOF without closing brace"); Host_Error("%s: EOF without closing brace", __func__);
} }
if (com_token[0] == '}') if (com_token[0] == '}')
{ {
Host_Error(__FUNCTION__ ": closing brace without data"); Host_Error("%s: closing brace without data", __func__);
} }
if (className != NULL && !Q_strcmp(className, com_token)) if (className != NULL && !Q_strcmp(className, com_token))
@ -300,7 +300,7 @@ void ED_LoadFromFile(char *data)
} }
if (com_token[0] != '{') if (com_token[0] != '{')
{ {
Host_Error(__FUNCTION__ ": found %s when expecting {", com_token); Host_Error("%s: found %s when expecting {", __func__, com_token);
} }
if (ent) if (ent)
@ -353,7 +353,7 @@ edict_t *EDICT_NUM(int n)
{ {
if (n < 0 || n >= g_psv.max_edicts) if (n < 0 || n >= g_psv.max_edicts)
{ {
Sys_Error(__FUNCTION__ ": bad number %i", n); Sys_Error("%s: bad number %i", __func__, n);
} }
return &g_psv.edicts[n]; return &g_psv.edicts[n];
} }
@ -365,7 +365,7 @@ int NUM_FOR_EDICT(const edict_t *e)
if (b < 0 || b >= g_psv.num_edicts) if (b < 0 || b >= g_psv.num_edicts)
{ {
Sys_Error(__FUNCTION__ ": bad pointer"); Sys_Error("%s: bad pointer", __func__);
} }
return b; return b;
@ -397,7 +397,7 @@ bool SuckOutClassname(char *szInputStream, edict_t *pEdict)
if (kvd.fHandled == FALSE) if (kvd.fHandled == FALSE)
{ {
Host_Error(__FUNCTION__ ": parse error"); Host_Error("%s: parse error", __func__);
} }
return true; return true;
@ -424,7 +424,7 @@ bool SuckOutClassname(char *szInputStream, edict_t *pEdict)
if (kvd.fHandled == FALSE) if (kvd.fHandled == FALSE)
{ {
Host_Error(__FUNCTION__ ": parse error"); Host_Error("%s: parse error", __func__);
} }
return true; return true;
@ -525,7 +525,7 @@ int EXT_FUNC IndexOfEdict(const edict_t *pEdict)
if (index < 0 || index > g_psv.max_edicts) if (index < 0 || index > g_psv.max_edicts)
#endif // REHLDS_FIXES #endif // REHLDS_FIXES
{ {
Sys_Error(__FUNCTION__ ": bad entity"); Sys_Error("%s: bad entity", __func__);
} }
} }
return index; return index;
@ -625,7 +625,7 @@ void EXT_FUNC SaveSpawnParms(edict_t *pEdict)
int eoffset = NUM_FOR_EDICT(pEdict); int eoffset = NUM_FOR_EDICT(pEdict);
if (eoffset < 1 || eoffset > g_psvs.maxclients) if (eoffset < 1 || eoffset > g_psvs.maxclients)
{ {
Host_Error("Entity is not a client"); Host_Error("%s: Entity is not a client", __func__);
} }
// Nothing more for this function even on client-side // Nothing more for this function even on client-side
} }

View File

@ -628,7 +628,7 @@ hull_t *R_StudioHull(model_t *pModel, float frame, int sequence, const vec_t *an
if (r_cachestudio.value != 0) if (r_cachestudio.value != 0)
{ {
#ifdef SWDS #ifdef SWDS
Sys_Error(__FUNCTION__ ": Studio state caching is not used on server"); Sys_Error("%s: Studio state caching is not used on server", __func__);
#endif #endif
// TODO: Reverse for client-side // TODO: Reverse for client-side
} }
@ -661,7 +661,7 @@ hull_t *R_StudioHull(model_t *pModel, float frame, int sequence, const vec_t *an
if (r_cachestudio.value != 0) if (r_cachestudio.value != 0)
{ {
#ifdef SWDS #ifdef SWDS
Sys_Error(__FUNCTION__ ": Studio state caching is not used on server"); Sys_Error("%s: Studio state caching is not used on server", __func__);
#endif #endif
// TODO: Reverse for client-side // TODO: Reverse for client-side
// R_AddToStudioCache(float frame, // R_AddToStudioCache(float frame,

View File

@ -327,7 +327,7 @@ delta_t *SV_LookupDelta(char *name)
p = p->next; p = p->next;
} }
Sys_Error(__FUNCTION__ ": Couldn't find delta for %s\n", name); Sys_Error("%s: Couldn't find delta for %s\n", __func__, name);
return NULL; return NULL;
} }
@ -423,7 +423,7 @@ void SV_ReallocateDynamicData(void)
{ {
if (!g_psv.max_edicts) if (!g_psv.max_edicts)
{ {
Con_DPrintf(__FUNCTION__ " with sv.max_edicts == 0\n"); Con_DPrintf("%s: sv.max_edicts == 0\n", __func__);
return; return;
} }
@ -470,6 +470,7 @@ qboolean SV_IsPlayerIndex(int index)
return (index >= 1 && index <= g_psvs.maxclients); return (index >= 1 && index <= g_psvs.maxclients);
} }
#ifdef _WIN32
qboolean __declspec(naked) SV_IsPlayerIndex_wrapped(int index) qboolean __declspec(naked) SV_IsPlayerIndex_wrapped(int index)
{ {
// Original SV_IsPlayerIndex in swds.dll doesn't modify ecx nor edx. // Original SV_IsPlayerIndex in swds.dll doesn't modify ecx nor edx.
@ -488,6 +489,12 @@ qboolean __declspec(naked) SV_IsPlayerIndex_wrapped(int index)
retn; retn;
} }
} }
#else // _WIN32
qboolean SV_IsPlayerIndex_wrapped(int index)
{
return SV_IsPlayerIndex(index);
}
#endif // _WIN32
void SV_ClearPacketEntities(client_frame_t *frame) void SV_ClearPacketEntities(client_frame_t *frame)
{ {
@ -777,22 +784,22 @@ qboolean SV_BuildSoundMsg(edict_t *entity, int channel, const char *sample, int
if (volume < 0 || volume > 255) if (volume < 0 || volume > 255)
{ {
Con_Printf(__FUNCTION__ ": volume = %i", volume); Con_Printf("%s: volume = %i", __func__, volume);
volume = (volume < 0) ? 0 : 255; volume = (volume < 0) ? 0 : 255;
} }
if (attenuation < 0.0f || attenuation > 4.0f) if (attenuation < 0.0f || attenuation > 4.0f)
{ {
Con_Printf(__FUNCTION__ ": attenuation = %f", attenuation); Con_Printf("%s: attenuation = %f", __func__, attenuation);
attenuation = (attenuation < 0.0f) ? 0.0f : 4.0f; attenuation = (attenuation < 0.0f) ? 0.0f : 4.0f;
} }
if (channel < 0 || channel > 7) if (channel < 0 || channel > 7)
{ {
Con_Printf(__FUNCTION__ ": channel = %i", channel); Con_Printf("%s: channel = %i", __func__, channel);
channel = (channel < 0) ? CHAN_AUTO : CHAN_NETWORKVOICE_BASE; channel = (channel < 0) ? CHAN_AUTO : CHAN_NETWORKVOICE_BASE;
} }
if (pitch < 0 || pitch > 255) if (pitch < 0 || pitch > 255)
{ {
Con_Printf(__FUNCTION__ ": pitch = %i", pitch); Con_Printf("%s: pitch = %i", __func__, pitch);
pitch = (pitch < 0) ? 0 : 255; pitch = (pitch < 0) ? 0 : 255;
} }
@ -804,7 +811,7 @@ qboolean SV_BuildSoundMsg(edict_t *entity, int channel, const char *sample, int
sound_num = Q_atoi(sample + 1); sound_num = Q_atoi(sample + 1);
if (sound_num >= CVOXFILESENTENCEMAX) if (sound_num >= CVOXFILESENTENCEMAX)
{ {
Con_Printf(__FUNCTION__ ": invalid sentence number: %s", sample + 1); Con_Printf("%s: invalid sentence number: %s", __func__, sample + 1);
return FALSE; return FALSE;
} }
} }
@ -818,7 +825,7 @@ qboolean SV_BuildSoundMsg(edict_t *entity, int channel, const char *sample, int
sound_num = SV_LookupSoundIndex(sample); sound_num = SV_LookupSoundIndex(sample);
if (!sound_num || !g_psv.sound_precache[sound_num]) if (!sound_num || !g_psv.sound_precache[sound_num])
{ {
Con_Printf(__FUNCTION__ ": %s not precached (%d)\n", sample, sound_num); Con_Printf("%s: %s not precached (%d)\n", __func__, sample, sound_num);
return FALSE; return FALSE;
} }
} }
@ -927,7 +934,7 @@ void SV_AddSampleToHashedLookupTable(const char *pszSample, int iSampleIndex)
index = 0; index = 0;
if (index == starting_index) if (index == starting_index)
Sys_Error(__FUNCTION__ ": NO FREE SLOTS IN SOUND LOOKUP TABLE"); Sys_Error("%s: NO FREE SLOTS IN SOUND LOOKUP TABLE", __func__);
} }
g_psv.sound_precache_hashedlookup[index] = iSampleIndex; g_psv.sound_precache_hashedlookup[index] = iSampleIndex;
@ -1848,7 +1855,7 @@ int EXT_FUNC SV_CheckProtocol_internal(netadr_t *adr, int nProtocol)
{ {
if (adr == NULL) if (adr == NULL)
{ {
Sys_Error(__FUNCTION__ ": Null address\n"); Sys_Error("%s: Null address\n", __func__);
} }
if (nProtocol == PROTOCOL_VERSION) if (nProtocol == PROTOCOL_VERSION)
@ -1901,7 +1908,7 @@ bool EXT_FUNC SV_CheckChallenge_api(const netadr_t &adr, int nChallengeValue) {
int SV_CheckChallenge(netadr_t *adr, int nChallengeValue) int SV_CheckChallenge(netadr_t *adr, int nChallengeValue)
{ {
if (!adr) if (!adr)
Sys_Error(__FUNCTION__ ": Null address\n"); Sys_Error("%s: Null address\n", __func__);
if (NET_IsLocalAddress(*adr)) if (NET_IsLocalAddress(*adr))
return 1; return 1;
@ -2646,19 +2653,19 @@ void SV_ResetModInfo(void)
nFileSize = FS_Size(hLibListFile); nFileSize = FS_Size(hLibListFile);
if (!nFileSize || (signed int)nFileSize > 256 * 1024) if (!nFileSize || (signed int)nFileSize > 256 * 1024)
{ {
Sys_Error("Game listing file size is bogus [%s: size %i]", "liblist.gam", nFileSize); Sys_Error("%s: Game listing file size is bogus [%s: size %i]", __func__, "liblist.gam", nFileSize);
} }
pszInputStream = (char *)Mem_Malloc(nFileSize + 1); pszInputStream = (char *)Mem_Malloc(nFileSize + 1);
if (!pszInputStream) if (!pszInputStream)
{ {
Sys_Error("Could not allocate space for game listing file of %i bytes", nFileSize + 1); Sys_Error("%s: Could not allocate space for game listing file of %i bytes", __func__, nFileSize + 1);
} }
nBytesRead = FS_Read(pszInputStream, nFileSize, 1, hLibListFile); nBytesRead = FS_Read(pszInputStream, nFileSize, 1, hLibListFile);
if (nBytesRead != nFileSize) if (nBytesRead != nFileSize)
{ {
Sys_Error("Error reading in game listing file, expected %i bytes, read %i", nFileSize, nBytesRead); Sys_Error("%s: Error reading in game listing file, expected %i bytes, read %i", __func__, nFileSize, nBytesRead);
} }
pszInputStream[nFileSize] = 0; pszInputStream[nFileSize] = 0;
@ -5055,7 +5062,7 @@ int SV_ModelIndex(const char *name)
}; };
#endif #endif
Sys_Error("SV_ModelIndex: model %s not precached", name); Sys_Error("%s: SV_ModelIndex: model %s not precached", __func__, name);
} }
void EXT_FUNC SV_AddResource(resourcetype_t type, const char *name, int size, unsigned char flags, int index) void EXT_FUNC SV_AddResource(resourcetype_t type, const char *name, int size, unsigned char flags, int index)
@ -5067,7 +5074,7 @@ void EXT_FUNC SV_AddResource(resourcetype_t type, const char *name, int size, un
if (g_psv.num_resources >= MAX_RESOURCE_LIST) if (g_psv.num_resources >= MAX_RESOURCE_LIST)
#endif // REHLDS_FIXES #endif // REHLDS_FIXES
{ {
Sys_Error("Too many resources on server."); Sys_Error("%s: Too many resources on server.", __func__);
} }
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
@ -5426,38 +5433,6 @@ void EXT_FUNC SV_WriteVoiceCodec_internal(sizebuf_t *pBuf)
MSG_WriteByte(pBuf, 0); MSG_WriteByte(pBuf, 0);
} }
/*
* Interface between engine and gamedll has a flaw which can lead to inconsistent behavior when passing arguments of type vec3_t to gamedll
* Consider function func(vec3_t v) defined in gamedll. vec3_t defined in gamedll as a class (not array), therefore it's expected that all vector components (12 bytes) will be written in the stack,
* i.e. the function signature may be represented as func(float v_0, float v_1, float v_2).
* In the engine, on the other hand, vec3_t is an array of vec_t (vec_t[3]). C/C++ compiler treats arguments of array type as pointers to array's first element, thus, on attempt to
* invoke gamedll's func(vec3_t v) from engine, only pointer to first vector's element will be passed in stack, while gamedll expects all 3 vector elements.
* This inconsistency in the interface between gamedll and engine leads to exposure of some data from stack of caller function to vector's elements in gamedll, which, in turn,
* leads to inconsistent behavior (since stack data may contain pointers) across different systems
*
* This functions emulates swds.dll behavior, i.e. it sends the same garbage when invoking CreateBaseline as swds.dll does.
* This is required since not emulating this behavior will break rehlds test demos
*/
void __invokeValvesBuggedCreateBaseline(void* func, int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec_t* pmins, vec_t* pmaxs)
{
__asm {
mov ecx, func
push 0
push 1
push 0
push 0
push pmaxs
push pmins
push playermodelindex
push entity
push baseline
push eindex
push player
call ecx
add esp, 0x2C
}
}
void SV_CreateBaseline(void) void SV_CreateBaseline(void)
{ {
edict_t *svent; edict_t *svent;
@ -5487,7 +5462,35 @@ void SV_CreateBaseline(void)
else else
g_psv.baselines[entnum].entityType = ENTITY_NORMAL; g_psv.baselines[entnum].entityType = ENTITY_NORMAL;
__invokeValvesBuggedCreateBaseline((void *)gEntityInterface.pfnCreateBaseline, player, entnum, &(g_psv.baselines[entnum]), svent, sv_playermodel, player_mins[0], player_maxs[0]); /*
* Interface between engine and gamedll has a flaw which can lead to inconsistent behavior when passing arguments of type vec3_t to gamedll
* Consider function func(vec3_t v) defined in gamedll. vec3_t defined in gamedll as a class (not array), therefore it's expected that all vector components (12 bytes) will be written in the stack,
* i.e. the function signature may be represented as func(float v_0, float v_1, float v_2).
* In the engine, on the other hand, vec3_t is an array of vec_t (vec_t[3]). C/C++ compiler treats arguments of array type as pointers to array's first element, thus, on attempt to
* invoke gamedll's func(vec3_t v) from engine, only pointer to first vector's element will be passed in stack, while gamedll expects all 3 vector elements.
* This inconsistency in the interface between gamedll and engine leads to exposure of some data from stack of caller function to vector's elements in gamedll, which, in turn,
* leads to inconsistent behavior (since stack data may contain pointers) across different systems.
*/
#ifdef REHLDS_FIXES
/*
* Fixed function call.
*/
typedef void CreateBaseline_t(int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec_t player_mins0, vec_t player_mins1, vec_t player_mins2, vec_t player_maxs0, vec_t player_maxs1, vec_t player_maxs2);
((CreateBaseline_t*)gEntityInterface.pfnCreateBaseline)(player, entnum, &(g_psv.baselines[entnum]), svent, sv_playermodel, player_mins[0][0], player_mins[0][1], player_mins[0][2], player_maxs[0][0], player_maxs[0][1], player_maxs[0][2]);
#else // REHLDS_FIXES
/*
* This function call emulates swds.dll behavior, i.e. it sends the same garbage when invoking CreateBaseline as swds.dll does.
* This is required since not emulating this behavior will break rehlds test demos.
*/
typedef void CreateBaseline_t(int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs, int dummy1, int dummy2, int dummy3, int dummy4);
((CreateBaseline_t*)gEntityInterface.pfnCreateBaseline)(player, entnum, &(g_psv.baselines[entnum]), svent, sv_playermodel, player_mins[0], player_maxs[0], 0, 0, 1, 0);
/*
* Bugged function call that is used in the original engine. Just for a reference.
*/
//gEntityInterface.pfnCreateBaseline(player, entnum, &(g_psv.baselines[entnum]), svent, sv_playermodel, player_mins[0], player_maxs[0]);
#endif // REHLDS_FIXES
sv_lastnum = entnum; sv_lastnum = entnum;
} }
} }
@ -5547,7 +5550,7 @@ void SV_BroadcastCommand(char *fmt, ...)
MSG_WriteByte(&msg, svc_stufftext); MSG_WriteByte(&msg, svc_stufftext);
MSG_WriteString(&msg, string); MSG_WriteString(&msg, string);
if (msg.flags & SIZEBUF_OVERFLOWED) if (msg.flags & SIZEBUF_OVERFLOWED)
Sys_Error("SV_BroadcastCommand: Overflowed on %s, %i is max size\n", string, msg.maxsize); Sys_Error("%s: Overflowed on %s, %i is max size\n", __func__, string, msg.maxsize);
for (int i = 0; i < g_psvs.maxclients; ++i) for (int i = 0; i < g_psvs.maxclients; ++i)
{ {
@ -6472,7 +6475,7 @@ void SV_BanId_f(void)
} }
if (id == NULL) if (id == NULL)
{ {
Con_Printf(__FUNCTION__ ": Couldn't find #userid %u\n", search); Con_Printf("%s: Couldn't find #userid %u\n", __func__, search);
return; return;
} }
} }
@ -6501,7 +6504,7 @@ void SV_BanId_f(void)
if (id == NULL) if (id == NULL)
{ {
Con_Printf(__FUNCTION__ ": Couldn't resolve uniqueid %s.\n", idstring); Con_Printf("%s: Couldn't resolve uniqueid %s.\n", __func__, idstring);
Con_Printf("Usage: banid <minutes> <uniqueid or #userid> { kick }\n"); Con_Printf("Usage: banid <minutes> <uniqueid or #userid> { kick }\n");
Con_Printf("Use 0 minutes for permanent\n"); Con_Printf("Use 0 minutes for permanent\n");
return; return;
@ -6519,7 +6522,7 @@ void SV_BanId_f(void)
{ {
if (numuserfilters >= MAX_USERFILTERS) if (numuserfilters >= MAX_USERFILTERS)
{ {
Con_Printf(__FUNCTION__ ": User filter list is full\n"); Con_Printf("%s: User filter list is full\n", __func__);
return; return;
} }
numuserfilters++; numuserfilters++;
@ -6806,7 +6809,7 @@ void SV_RemoveId_f(void)
if (!idstring[0]) if (!idstring[0])
{ {
Con_Printf(__FUNCTION__ ": Id string is empty!\n"); Con_Printf("%s: Id string is empty!\n", __func__);
return; return;
} }
@ -6815,7 +6818,7 @@ void SV_RemoveId_f(void)
int slot = Q_atoi(&idstring[1]); int slot = Q_atoi(&idstring[1]);
if (slot <= 0 || slot > numuserfilters) if (slot <= 0 || slot > numuserfilters)
{ {
Con_Printf(__FUNCTION__ ": invalid slot #%i\n", slot); Con_Printf("%s: invalid slot #%i\n", __func__, slot);
return; return;
} }
slot--; slot--;
@ -7659,7 +7662,7 @@ void SV_RegisterDelta(char *name, char *loadfile)
{ {
delta_t *pdesc = NULL; delta_t *pdesc = NULL;
if (!DELTA_Load(name, &pdesc, loadfile)) if (!DELTA_Load(name, &pdesc, loadfile))
Sys_Error("Error parsing %s!!!\n", loadfile); Sys_Error("%s: Error parsing %s!!!\n", __func__, loadfile);
delta_info_t *p = (delta_info_t *)Mem_ZeroMalloc(sizeof(delta_info_t)); delta_info_t *p = (delta_info_t *)Mem_ZeroMalloc(sizeof(delta_info_t));
p->loadfile = Mem_Strdup(loadfile); p->loadfile = Mem_Strdup(loadfile);
@ -7686,32 +7689,32 @@ void SV_InitDeltas(void)
g_pplayerdelta = SV_LookupDelta("entity_state_player_t"); g_pplayerdelta = SV_LookupDelta("entity_state_player_t");
if (!g_pplayerdelta) if (!g_pplayerdelta)
Sys_Error("No entity_state_player_t encoder on server!\n"); Sys_Error("%s: No entity_state_player_t encoder on server!\n", __func__);
g_pentitydelta = SV_LookupDelta("entity_state_t"); g_pentitydelta = SV_LookupDelta("entity_state_t");
if (!g_pentitydelta) if (!g_pentitydelta)
Sys_Error("No entity_state_t encoder on server!\n"); Sys_Error("%s: No entity_state_t encoder on server!\n", __func__);
g_pcustomentitydelta = SV_LookupDelta("custom_entity_state_t"); g_pcustomentitydelta = SV_LookupDelta("custom_entity_state_t");
if (!g_pcustomentitydelta) if (!g_pcustomentitydelta)
Sys_Error("No custom_entity_state_t encoder on server!\n"); Sys_Error("%s: No custom_entity_state_t encoder on server!\n", __func__);
g_pclientdelta = SV_LookupDelta("clientdata_t"); g_pclientdelta = SV_LookupDelta("clientdata_t");
if (!g_pclientdelta) if (!g_pclientdelta)
Sys_Error("No clientdata_t encoder on server!\n"); Sys_Error("%s: No clientdata_t encoder on server!\n", __func__);
g_pweapondelta = SV_LookupDelta("weapon_data_t"); g_pweapondelta = SV_LookupDelta("weapon_data_t");
if (!g_pweapondelta) if (!g_pweapondelta)
Sys_Error("No weapon_data_t encoder on server!\n"); Sys_Error("%s: No weapon_data_t encoder on server!\n", __func__);
g_peventdelta = SV_LookupDelta("event_t"); g_peventdelta = SV_LookupDelta("event_t");
if (!g_peventdelta) if (!g_peventdelta)
Sys_Error("No event_t encoder on server!\n"); Sys_Error("%s: No event_t encoder on server!\n", __func__);
#ifdef REHLDS_OPT_PEDANTIC #ifdef REHLDS_OPT_PEDANTIC
g_pusercmddelta = SV_LookupDelta("usercmd_t"); g_pusercmddelta = SV_LookupDelta("usercmd_t");
if (!g_pusercmddelta) if (!g_pusercmddelta)
Sys_Error("No usercmd_t encoder on server!\n"); Sys_Error("%s: No usercmd_t encoder on server!\n", __func__);
#endif #endif
#if defined(REHLDS_OPT_PEDANTIC) || defined(REHLDS_FIXES) #if defined(REHLDS_OPT_PEDANTIC) || defined(REHLDS_FIXES)

View File

@ -42,11 +42,11 @@
#define c_yes (*pc_yes) #define c_yes (*pc_yes)
#define c_no (*pc_no) #define c_no (*pc_no)
#endif // HOOK_ENGINE
extern int c_yes; extern int c_yes;
extern int c_no; extern int c_no;
#endif // HOOK_ENGINE
qboolean SV_CheckBottom(edict_t *ent); qboolean SV_CheckBottom(edict_t *ent);
qboolean SV_movetest(edict_t *ent, vec_t *move, qboolean relink); qboolean SV_movetest(edict_t *ent, vec_t *move, qboolean relink);
qboolean SV_movestep(edict_t *ent, vec_t *move, qboolean relink); qboolean SV_movestep(edict_t *ent, vec_t *move, qboolean relink);

View File

@ -255,7 +255,7 @@ int SV_FlyMove(edict_t *ent, float time, trace_t *steptrace)
break; break;
if (!trace.ent) if (!trace.ent)
Sys_Error("SV_FlyMove: !trace.ent"); Sys_Error("%s: !trace.ent", __func__);
if (trace.plane.normal[2] > 0.7) if (trace.plane.normal[2] > 0.7)
{ {
@ -621,7 +621,7 @@ int SV_PushRotate(edict_t *pusher, float movetime)
++num_moved; ++num_moved;
if (num_moved >= g_psv.max_edicts) if (num_moved >= g_psv.max_edicts)
Sys_Error("Out of edicts in simulator!\n"); Sys_Error("%s: Out of edicts in simulator!\n", __func__);
vec3_t start, end, push, move; vec3_t start, end, push, move;
@ -1392,7 +1392,7 @@ void SV_Physics(void)
break; break;
default: default:
Sys_Error("SV_Physics: %s bad movetype %d", &pr_strings[ent->v.classname], ent->v.movetype); Sys_Error("%s: %s bad movetype %d", __func__, &pr_strings[ent->v.classname], ent->v.movetype);
} }
if (ent->v.flags & FL_KILLME) if (ent->v.flags & FL_KILLME)

View File

@ -672,7 +672,7 @@ qboolean Steam_NotifyClientConnect_internal(client_t *cl, const void *pvSteam2Ke
{ {
return Steam3Server()->NotifyClientConnect(cl, pvSteam2Key, ucbSteam2Key); return Steam3Server()->NotifyClientConnect(cl, pvSteam2Key, ucbSteam2Key);
} }
return NULL; return FALSE;
} }
qboolean EXT_FUNC Steam_NotifyBotConnect_api(IGameClient* cl) qboolean EXT_FUNC Steam_NotifyBotConnect_api(IGameClient* cl)
@ -691,7 +691,7 @@ qboolean Steam_NotifyBotConnect_internal(client_t *cl)
{ {
return Steam3Server()->NotifyBotConnect(cl); return Steam3Server()->NotifyBotConnect(cl);
} }
return NULL; return FALSE;
} }
void EXT_FUNC Steam_NotifyClientDisconnect_api(IGameClient* cl) void EXT_FUNC Steam_NotifyClientDisconnect_api(IGameClient* cl)

View File

@ -90,7 +90,7 @@ void SV_ClearResourceLists(client_t *cl)
{ {
if (!cl) if (!cl)
{ {
Sys_Error("SV_ClearResourceLists with NULL client!"); Sys_Error("%s: SV_ClearResourceLists with NULL client!", __func__);
} }
SV_ClearResourceList(&cl->resourcesneeded); SV_ClearResourceList(&cl->resourcesneeded);
@ -165,7 +165,7 @@ void SV_Customization(client_t *pPlayer, resource_t *pResource, qboolean bSkipPl
} }
if (i == g_psvs.maxclients) if (i == g_psvs.maxclients)
{ {
Sys_Error("Couldn't find player index for customization."); Sys_Error("%s: Couldn't find player index for customization.", __func__);
} }
nPlayerNumber = i; nPlayerNumber = i;

View File

@ -315,7 +315,7 @@ int EXT_FUNC SV_TransferConsistencyInfo_internal(void)
vec3_t maxs; vec3_t maxs;
if (!R_GetStudioBounds(filename, mins, maxs)) if (!R_GetStudioBounds(filename, mins, maxs))
Host_Error("Server unable to get bounds for %s\n", filename); Host_Error("%s: Server unable to get bounds for %s\n", __func__, filename);
Q_memcpy(&r->rguc_reserved[1], mins, sizeof(mins)); Q_memcpy(&r->rguc_reserved[1], mins, sizeof(mins));
Q_memcpy(&r->rguc_reserved[13], maxs, sizeof(maxs)); Q_memcpy(&r->rguc_reserved[13], maxs, sizeof(maxs));

View File

@ -263,7 +263,7 @@ void __cdecl Sys_InitHardwareTimer()
Sys_InitFPUControlWords(); Sys_InitFPUControlWords();
if (!CRehldsPlatformHolder::get()->QueryPerfFreq(&perfFreq)) if (!CRehldsPlatformHolder::get()->QueryPerfFreq(&perfFreq))
Sys_Error("No hardware timer available"); Sys_Error("%s: No hardware timer available", __func__);
perfHighPart = perfFreq.HighPart; perfHighPart = perfFreq.HighPart;
perfLowPart = perfFreq.LowPart; perfLowPart = perfFreq.LowPart;
@ -308,7 +308,7 @@ const char *Sys_FindFirst(const char *path, char *basename)
{ {
if (g_hfind != -1) if (g_hfind != -1)
{ {
Sys_Error(__FUNCTION__ " without close"); Sys_Error("%s: called without close", __func__);
} }
const char *psz = FS_FindFirst(path, &g_hfind, 0); const char *psz = FS_FindFirst(path, &g_hfind, 0);
@ -333,7 +333,10 @@ const char *Sys_FindFirstPathID(const char *path, char *pathid)
{ {
//const char *psz;//unused? //const char *psz;//unused?
if (g_hfind != -1) if (g_hfind != -1)
Sys_Error("Sys_FindFirst without close"); {
Sys_Error("%s: called without close", __func__);
}
return FS_FindFirst(path, &g_hfind, pathid); return FS_FindFirst(path, &g_hfind, pathid);
} }
@ -403,7 +406,7 @@ NOXREF void Sys_MakeCodeWriteable(uint32 startaddr, uint32 length)
NOXREFCHECK; NOXREFCHECK;
#ifdef _WIN32 #ifdef _WIN32
if (!VirtualProtect((LPVOID)startaddr, length, PAGE_EXECUTE_READWRITE, (PDWORD)&length)) if (!VirtualProtect((LPVOID)startaddr, length, PAGE_EXECUTE_READWRITE, (PDWORD)&length))
Sys_Error("Protection change failed."); Sys_Error("%s: Protection change failed.", __func__);
#endif // _WIN32 #endif // _WIN32
} }
@ -505,9 +508,10 @@ void NORETURN Sys_Error(const char *error, ...)
} }
#endif // SWDS #endif // SWDS
//exit(-1);
//Allahu akbar! //Allahu akbar!
*(int *)NULL = NULL; int *null = 0;
*null = 0;
exit(-1);
} }
NOXREF void Sys_Warning(const char *pszWarning, ...) NOXREF void Sys_Warning(const char *pszWarning, ...)
@ -901,15 +905,15 @@ void LoadEntityDLLs(const char *szBaseDir)
nFileSize = FS_Size(hLibListFile); nFileSize = FS_Size(hLibListFile);
nFileSize2 = nFileSize; nFileSize2 = nFileSize;
if (!nFileSize || (signed int)nFileSize > 262144) if (!nFileSize || (signed int)nFileSize > 262144)
Sys_Error("Game listing file size is bogus [%s: size %i]", "liblist.gam", nFileSize); Sys_Error("%s: Game listing file size is bogus [%s: size %i]", __func__, "liblist.gam", nFileSize);
pszInputStream = (char *)Mem_Malloc(nFileSize + 1); pszInputStream = (char *)Mem_Malloc(nFileSize + 1);
if (!pszInputStream) if (!pszInputStream)
Sys_Error("Could not allocate space for game listing file of %i bytes", nFileSize2 + 1); Sys_Error("%s: Could not allocate space for game listing file of %i bytes", __func__, nFileSize2 + 1);
nBytesRead = FS_Read(pszInputStream, nFileSize2, 1, hLibListFile); nBytesRead = FS_Read(pszInputStream, nFileSize2, 1, hLibListFile);
if (nBytesRead != nFileSize2) if (nBytesRead != nFileSize2)
Sys_Error("Error reading in game listing file, expected %i bytes, read %i", nFileSize2, nBytesRead); Sys_Error("%s: Error reading in game listing file, expected %i bytes, read %i", __func__, nFileSize2, nBytesRead);
pszInputStream[nFileSize2] = 0; pszInputStream[nFileSize2] = 0;
pStreamPos = pszInputStream; pStreamPos = pszInputStream;

View File

@ -42,17 +42,12 @@
#define __LINE__AS_STRING __HACK_LINE_AS_STRING__(__LINE__) //Gives you the line number in constant string form #define __LINE__AS_STRING __HACK_LINE_AS_STRING__(__LINE__) //Gives you the line number in constant string form
#if defined _MSC_VER || defined __INTEL_COMPILER #if defined _MSC_VER || defined __INTEL_COMPILER
#define NOXREFCHECK __asm { push [ebp + 4] } Sys_Error("[NOXREFCHECK]:" __FUNCTION__ " (" __FILE__ ":"__LINE__AS_STRING") NOXREF, but called from 0x%.08x") #define NOXREFCHECK int __retAddr; __asm { __asm mov eax, [ebp + 4] __asm mov __retAddr, eax }; Sys_Error("[NOXREFCHECK]: %s: (" __FILE__ ":" __LINE__AS_STRING ") NOXREF, but called from 0x%.08x", __func__, __retAddr)
#else #else
#define NOXREFCHECK const char* noxref_msg = "[NOXREFCHECK]:" __FUNCTION__ " (" __FILE__ ":"__LINE__AS_STRING") NOXREF, but called from 0x%.08x"; \ // For EBP based stack (older gcc) (uncomment version apropriate for your compiler)
asm volatile ( \ //#define NOXREFCHECK int __retAddr; __asm__ __volatile__("movl 4(%%ebp), %%eax;" "movl %%eax, %0":"=r"(__retAddr)::"%eax"); Sys_Error("[NOXREFCHECK]: %s: (" __FILE__ ":" __LINE__AS_STRING ") NOXREF, but called from 0x%.08x", __func__, __retAddr);
"pushl 4(%%ebp)\n\t" \ // For ESP based stack (newer gcc) (uncomment version apropriate for your compiler)
"pushl %0\n\t" \ #define NOXREFCHECK int __retAddr; __asm__ __volatile__("movl 16(%%esp), %%eax;" "movl %%eax, %0":"=r"(__retAddr)::"%eax"); Sys_Error("[NOXREFCHECK]: %s: (" __FILE__ ":" __LINE__AS_STRING ") NOXREF, but called from 0x%.08x", __func__, __retAddr);
"call $Sys_Error\n\t" \
"addl %%esp, $8\n\t" \
:: \
"m" (noxref_msg) \
);
#endif #endif
@ -172,7 +167,7 @@ NOBODY void MaskExceptions(void);
NOBODY void Sys_Init(void); NOBODY void Sys_Init(void);
NOXREF void Sys_Sleep(int msec); NOXREF void Sys_Sleep(int msec);
NOBODY void Sys_DebugOutStraight(const char *pStr); NOBODY void Sys_DebugOutStraight(const char *pStr);
NOBODY void NORETURN Sys_Error(const char *error, ...); void NORETURN Sys_Error(const char *error, ...);
NOXREF void Sys_Warning(const char *pszWarning, ...); NOXREF void Sys_Warning(const char *pszWarning, ...);
void Sys_Printf(const char *fmt, ...); void Sys_Printf(const char *fmt, ...);
void Sys_Quit(void); void Sys_Quit(void);

View File

@ -203,7 +203,7 @@ void Sys_CheckOSVersion(void)
Q_memset(&verInfo, 0, sizeof(verInfo)); Q_memset(&verInfo, 0, sizeof(verInfo));
verInfo.dwOSVersionInfoSize = sizeof(verInfo); verInfo.dwOSVersionInfoSize = sizeof(verInfo);
if (!GetVersionEx(&verInfo)) if (!GetVersionEx(&verInfo))
Sys_Error("Couldn't get OS info"); Sys_Error("%s: Couldn't get OS info", __func__);
g_WinNTOrHigher = verInfo.dwMajorVersion >= 4; g_WinNTOrHigher = verInfo.dwMajorVersion >= 4;
if (verInfo.dwPlatformId == 1 && verInfo.dwMajorVersion == 4) if (verInfo.dwPlatformId == 1 && verInfo.dwMajorVersion == 4)
@ -348,7 +348,7 @@ void Sys_InitMemory(void)
if (lpBuffer.dwTotalPhys) if (lpBuffer.dwTotalPhys)
{ {
if (lpBuffer.dwTotalPhys < FIFTEEN_MB) if (lpBuffer.dwTotalPhys < FIFTEEN_MB)
Sys_Error("Available memory less than 15MB!!! %i", host_parms.memsize); Sys_Error("%s: Available memory less than 15MB!!! %i", __func__, host_parms.memsize);
host_parms.memsize = (int)(lpBuffer.dwTotalPhys >> 1); host_parms.memsize = (int)(lpBuffer.dwTotalPhys >> 1);
if (host_parms.memsize < MINIMUM_WIN_MEMORY) if (host_parms.memsize < MINIMUM_WIN_MEMORY)
@ -376,7 +376,7 @@ void Sys_InitMemory(void)
#endif // _WIN32 #endif // _WIN32
if (!host_parms.membase) if (!host_parms.membase)
Sys_Error("Unable to allocate %.2f MB\n", (float)host_parms.memsize / (1024.0f * 1024.0f)); Sys_Error("%s: Unable to allocate %.2f MB\n", __func__, (float)host_parms.memsize / (1024.0f * 1024.0f));
} }
void Sys_ShutdownMemory(void) void Sys_ShutdownMemory(void)
@ -693,7 +693,7 @@ bool CDedicatedServerAPI::Init_noVirt(char *basedir, char *cmdline, CreateInterf
g_bIsDedicatedServer = TRUE; g_bIsDedicatedServer = TRUE;
TraceInit("FileSystem_Init(basedir, (void *)filesystemFactory)", "FileSystem_Shutdown()", 0); TraceInit("FileSystem_Init(basedir, (void *)filesystemFactory)", "FileSystem_Shutdown()", 0);
if (FileSystem_Init(basedir, filesystemFactory) && game->Init(0) && eng->Load(true, basedir, cmdline)) if (FileSystem_Init(basedir, (void *)filesystemFactory) && game->Init(0) && eng->Load(true, basedir, cmdline))
{ {
char text[256]; char text[256];
Q_snprintf(text, ARRAYSIZE(text), "exec %s\n", servercfgfile.string); Q_snprintf(text, ARRAYSIZE(text), "exec %s\n", servercfgfile.string);

View File

@ -88,7 +88,7 @@ void ForceReloadProfile()
//SDL_GL_SetSwapInterval((gl_vsync.value <= 0.0) - 1); //SDL_GL_SetSwapInterval((gl_vsync.value <= 0.0) - 1);
if (g_pcls.state != ca_dedicated) if (g_pcls.state != ca_dedicated)
{ {
Sys_Error("Only dedicated mode is supported"); Sys_Error("%s: Only dedicated mode is supported", __func__);
/* /*
v0 = GetRateRegistrySetting(rate.string); v0 = GetRateRegistrySetting(rate.string);
Q_strncpy(szRate, v0, 0x20u); Q_strncpy(szRate, v0, 0x20u);

View File

@ -55,7 +55,7 @@ cvar_t r_wadtextures;
void SafeRead(FileHandle_t f, void *buffer, int count) void SafeRead(FileHandle_t f, void *buffer, int count)
{ {
if (FS_Read(buffer, count, 1, f) != count) if (FS_Read(buffer, count, 1, f) != count)
Sys_Error("File read failure"); Sys_Error("%s: File read failure", __func__);
} }
void CleanupName(char *in, char *out) void CleanupName(char *in, char *out)
@ -122,12 +122,12 @@ qboolean TEX_InitFromWad(char *path)
texfile = FS_Open(wadPath, "rb"); texfile = FS_Open(wadPath, "rb");
texfiles[nTexFiles++] = texfile; texfiles[nTexFiles++] = texfile;
if (!texfile) if (!texfile)
Sys_Error("WARNING: couldn't open %s\n", wadPath); Sys_Error("%s: couldn't open %s\n", __func__, wadPath);
Con_DPrintf("Using WAD File: %s\n", wadPath); Con_DPrintf("Using WAD File: %s\n", wadPath);
SafeRead(texfile, &header, 12); SafeRead(texfile, &header, 12);
if (Q_strncmp(header.identification, "WAD2", 4) && Q_strncmp(header.identification, "WAD3", 4)) if (Q_strncmp(header.identification, "WAD2", 4) && Q_strncmp(header.identification, "WAD3", 4))
Sys_Error("TEX_InitFromWad: %s isn't a wadfile", wadPath); Sys_Error("%s: %s isn't a wadfile", __func__, wadPath);
header.numlumps = LittleLong(header.numlumps); header.numlumps = LittleLong(header.numlumps);
header.infotableofs = LittleLong(header.infotableofs); header.infotableofs = LittleLong(header.infotableofs);
@ -196,7 +196,7 @@ int FindMiptex(char *name)
} }
if (nummiptex == 512) if (nummiptex == 512)
Sys_Error("Exceeded MAX_MAP_TEXTURES"); Sys_Error("%s: Exceeded MAX_MAP_TEXTURES", __func__);
Q_strncpy(miptex[i], name, 63); Q_strncpy(miptex[i], name, 63);
miptex[i][63] = 0; miptex[i][63] = 0;

View File

@ -347,7 +347,7 @@ NOXREF void TextMessageParse(unsigned char *pMemFile, int fileSize)
while (memfgets(pMemFile, fileSize, &filePos, buf, 512) != NULL) while (memfgets(pMemFile, fileSize, &filePos, buf, 512) != NULL)
{ {
if(messageCount >= MAX_MESSAGES) if(messageCount >= MAX_MESSAGES)
Sys_Error("tmessage::TextMessageParse : messageCount>=MAX_MESSAGES"); Sys_Error("%s: messageCount >= MAX_MESSAGES", __func__);
TrimSpace(buf, trim); TrimSpace(buf, trim);
switch (mode) switch (mode)

View File

@ -69,8 +69,8 @@ int W_LoadWadFile(char *filename)
if (!wad->wad_base) if (!wad->wad_base)
{ {
if (!slot) if (!slot)
Sys_Error("W_LoadWadFile: couldn't load %s", filename); Sys_Error("%s: couldn't load %s", __func__, filename);
Con_Printf("WARNING: W_LoadWadFile, couldn't load %s\n", filename); Con_Printf("WARNING: %s, couldn't load %s\n", __func__, filename);
return -1; return -1;
} }
@ -79,7 +79,7 @@ int W_LoadWadFile(char *filename)
wad->wadname[sizeof(wad->wadname) - 1] = 0; wad->wadname[sizeof(wad->wadname) - 1] = 0;
wad->loaded = TRUE; wad->loaded = TRUE;
if (*(uint32 *)header->identification != MAKEID('W', 'A', 'D', '3')) if (*(uint32 *)header->identification != MAKEID('W', 'A', 'D', '3'))
Sys_Error("Wad file %s doesn't have WAD3 id\n", filename); Sys_Error("%s: Wad file %s doesn't have WAD3 id\n", __func__, filename);
wad->wad_numlumps = LittleLong(header->numlumps); wad->wad_numlumps = LittleLong(header->numlumps);
lumpinfo_t * lump_p = (lumpinfo_t *)&wad->wad_base[LittleLong(header->infotableofs)]; lumpinfo_t * lump_p = (lumpinfo_t *)&wad->wad_base[LittleLong(header->infotableofs)];
@ -112,7 +112,7 @@ lumpinfo_t *W_GetLumpinfo(int wad, char *name, qboolean doerror)
} }
if (doerror) if (doerror)
Sys_Error("W_GetLumpinfo: %s not found", name); Sys_Error("%s: %s not found", __func__, name);
return NULL; return NULL;
} }
@ -130,7 +130,7 @@ NOXREF void *W_GetLumpNum(int wad, int num)
NOXREFCHECK; NOXREFCHECK;
lumpinfo_t *lump; lumpinfo_t *lump;
if (num < 0 || num > wads[wad].wad_numlumps) if (num < 0 || num > wads[wad].wad_numlumps)
Sys_Error("W_GetLumpNum: bad number: %i", num); Sys_Error("%s: bad number: %i", __func__, num);
lump = wads[wad].wad_lumps; lump = wads[wad].wad_lumps;
return (void *)&wads[wad].wad_base[lump->filepos]; return (void *)&wads[wad].wad_base[lump->filepos];

View File

@ -164,7 +164,7 @@ struct hull_s *SV_HullForBsp(edict_t *ent, const vec_t *mins, const vec_t *maxs,
model = Mod_Handle(ent->v.modelindex); model = Mod_Handle(ent->v.modelindex);
if (!model || model->type != mod_brush) if (!model || model->type != mod_brush)
Sys_Error("Hit a %s with no model (%s)", &pr_strings[ent->v.classname], &pr_strings[ent->v.model]); Sys_Error("%s: Hit a %s with no model (%s)", __func__, &pr_strings[ent->v.classname], &pr_strings[ent->v.model]);
float xSize = maxs[0] - mins[0]; float xSize = maxs[0] - mins[0];
if (xSize > 8.0f) if (xSize > 8.0f)
@ -220,7 +220,7 @@ hull_t *SV_HullForEntity(edict_t *ent, const vec_t *mins, const vec_t *maxs, vec
if (ent->v.solid == SOLID_BSP) if (ent->v.solid == SOLID_BSP)
{ {
if (ent->v.movetype != MOVETYPE_PUSH && ent->v.movetype != MOVETYPE_PUSHSTEP) if (ent->v.movetype != MOVETYPE_PUSH && ent->v.movetype != MOVETYPE_PUSHSTEP)
Sys_Error("SOLID_BSP without MOVETYPE_PUSH"); Sys_Error("%s: SOLID_BSP without MOVETYPE_PUSH", __func__);
return SV_HullForBsp(ent, mins, maxs, offset); return SV_HullForBsp(ent, mins, maxs, offset);
} }
@ -602,7 +602,7 @@ int SV_HullPointContents(hull_t *hull, int num, const vec_t *p)
while (i >= 0) while (i >= 0)
{ {
if (hull->firstclipnode > i || hull->lastclipnode < i) if (hull->firstclipnode > i || hull->lastclipnode < i)
Sys_Error(__FUNCTION__ ": bad node number"); Sys_Error("%s: bad node number", __func__);
node = &hull->clipnodes[i]; node = &hull->clipnodes[i];
plane = &hull->planes[node->planenum]; plane = &hull->planes[node->planenum];
if (plane->type > 2) if (plane->type > 2)
@ -753,7 +753,7 @@ qboolean SV_RecursiveHullCheck(hull_t *hull, int num, float p1f, float p2f, cons
if (num >= 0) if (num >= 0)
{ {
if (num < hull->firstclipnode || num > hull->lastclipnode || !hull->planes) if (num < hull->firstclipnode || num > hull->lastclipnode || !hull->planes)
Sys_Error(__FUNCTION__ ": bad node number"); Sys_Error("%s: bad node number", __func__);
node = &hull->clipnodes[num]; node = &hull->clipnodes[num];
plane = &hull->planes[hull->clipnodes[num].planenum]; plane = &hull->planes[hull->clipnodes[num].planenum];
@ -893,7 +893,7 @@ qboolean SV_RecursiveHullCheck(hull_t *hull, int num, float p1f, float p2f, cons
pdif = p2f - p1f; pdif = p2f - p1f;
if (num < hull->firstclipnode || num > hull->lastclipnode || !hull->planes) if (num < hull->firstclipnode || num > hull->lastclipnode || !hull->planes)
Sys_Error(__FUNCTION__ ": bad node number"); Sys_Error("%s: bad node number", __func__);
node = &hull->clipnodes[num]; node = &hull->clipnodes[num];
plane = &hull->planes[hull->clipnodes[num].planenum]; plane = &hull->planes[hull->clipnodes[num].planenum];
@ -1185,7 +1185,7 @@ void SV_ClipToLinks(areanode_t *node, moveclip_t *clip)
continue; continue;
if (touch->v.solid == SOLID_TRIGGER) if (touch->v.solid == SOLID_TRIGGER)
Sys_Error("Trigger in clipping list"); Sys_Error("%s: Trigger in clipping list", __func__);
if (gNewDLLFunctions.pfnShouldCollide && !gNewDLLFunctions.pfnShouldCollide(touch, clip->passedict)) if (gNewDLLFunctions.pfnShouldCollide && !gNewDLLFunctions.pfnShouldCollide(touch, clip->passedict))
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES

View File

@ -98,19 +98,19 @@ void Z_Free(void *ptr)
{ {
if (!ptr) if (!ptr)
{ {
Sys_Error(__FUNCTION__ ": NULL pointer"); Sys_Error("%s: NULL pointer", __func__);
} }
memblock_t *block = (memblock_t *)((char *)ptr - sizeof(memblock_t)); memblock_t *block = (memblock_t *)((char *)ptr - sizeof(memblock_t));
if (block->id != ZONEID) if (block->id != ZONEID)
{ {
Sys_Error(__FUNCTION__ ": freed a pointer without ZONEID"); Sys_Error("%s: freed a pointer without ZONEID", __func__);
} }
if (!block->tag) if (!block->tag)
{ {
Sys_Error(__FUNCTION__ ": freed a freed pointer"); Sys_Error("%s: freed a freed pointer", __func__);
} }
block->tag = 0; block->tag = 0;
@ -154,7 +154,7 @@ void *Z_Malloc(int size)
if (!buf) if (!buf)
{ {
Sys_Error(__FUNCTION__ ": failed on allocation of %i bytes", size); Sys_Error("%s: failed on allocation of %i bytes", __func__, size);
} }
Q_memset(buf, 0, size); Q_memset(buf, 0, size);
@ -168,7 +168,7 @@ void *Z_TagMalloc(int size, int tag)
if (tag == 0) if (tag == 0)
{ {
Sys_Error(__FUNCTION__ ": tried to use a 0 tag"); Sys_Error("%s: tried to use a 0 tag", __func__);
} }
size += sizeof(memblock_t); size += sizeof(memblock_t);
@ -266,17 +266,17 @@ void Z_CheckHeap(void)
if ((byte *)block + block->size != (byte *)block->next) if ((byte *)block + block->size != (byte *)block->next)
{ {
Sys_Error(__FUNCTION__ ": block size does not touch the next block\n"); Sys_Error("%s: block size does not touch the next block\n", __func__);
} }
if (block->next->prev != block) if (block->next->prev != block)
{ {
Sys_Error(__FUNCTION__ ": next block doesn't have proper back link\n"); Sys_Error("%s: next block doesn't have proper back link\n", __func__);
} }
if (!block->tag && !block->next->tag) if (!block->tag && !block->next->tag)
{ {
Sys_Error(__FUNCTION__ ": two consecutive free blocks\n"); Sys_Error("%s: two consecutive free blocks\n", __func__);
} }
} }
} }
@ -320,12 +320,12 @@ void Hunk_Check(void)
{ {
if (h->sentinel != HUNK_SENTINEL) if (h->sentinel != HUNK_SENTINEL)
{ {
Sys_Error(__FUNCTION__ ": trahsed sentinel"); Sys_Error("%s: trahsed sentinel", __func__);
} }
if (h->size < 16 || h->size + (byte *)h - hunk_base > hunk_size) if (h->size < 16 || h->size + (byte *)h - hunk_base > hunk_size)
{ {
Sys_Error(__FUNCTION__ ": bad size"); Sys_Error("%s: bad size", __func__);
} }
} }
} }
@ -384,9 +384,9 @@ NOXREF void Hunk_Print(qboolean all)
// run consistancy checks // run consistancy checks
// //
if (h->sentinel != HUNK_SENTINEL) if (h->sentinel != HUNK_SENTINEL)
Sys_Error(__FUNCTION__ ": trahsed sentinal"); Sys_Error("%s: trahsed sentinal", __func__);
if (h->size < 16 || h->size + (byte *)h - hunk_base > hunk_size) if (h->size < 16 || h->size + (byte *)h - hunk_base > hunk_size)
Sys_Error(__FUNCTION__ ": bad size"); Sys_Error("%s: bad size", __func__);
next = (hunk_t *)((byte *)h + h->size); next = (hunk_t *)((byte *)h + h->size);
count++; count++;
@ -429,14 +429,14 @@ void *Hunk_AllocName(int size, const char *name)
{ {
if (size < 0) if (size < 0)
{ {
Sys_Error(__FUNCTION__ ": bad size: %i", size); Sys_Error("%s: bad size: %i", __func__, size);
} }
int totalsize = ((size + 15) & ~15) + sizeof(hunk_t); int totalsize = ((size + 15) & ~15) + sizeof(hunk_t);
if (hunk_size - hunk_high_used - hunk_low_used < totalsize) if (hunk_size - hunk_high_used - hunk_low_used < totalsize)
{ {
Sys_Error(__FUNCTION__ ": failed on %i bytes", totalsize); Sys_Error("%s: failed on %i bytes", __func__, totalsize);
} }
hunk_t *h = (hunk_t *)(hunk_base + hunk_low_used); hunk_t *h = (hunk_t *)(hunk_base + hunk_low_used);
@ -467,7 +467,7 @@ void Hunk_FreeToLowMark(int mark)
{ {
if (mark < 0 || mark > hunk_low_used) if (mark < 0 || mark > hunk_low_used)
{ {
Sys_Error(__FUNCTION__ ": bad mark %i", mark); Sys_Error("%s: bad mark %i", __func__, mark);
} }
hunk_low_used = mark; hunk_low_used = mark;
@ -494,7 +494,7 @@ void Hunk_FreeToHighMark(int mark)
if (mark < 0 || mark > hunk_high_used) if (mark < 0 || mark > hunk_high_used)
{ {
Sys_Error(__FUNCTION__ ": bad mark %i", mark); Sys_Error("%s: bad mark %i", __func__, mark);
} }
hunk_high_used = mark; hunk_high_used = mark;
@ -511,7 +511,7 @@ void *Hunk_HighAllocName(int size, const char *name)
hunk_t *h; hunk_t *h;
if (size < 0) if (size < 0)
{ {
Sys_Error(__FUNCTION__ ": bad size: %i", size); Sys_Error("%s: bad size: %i", __func__, size);
} }
if (hunk_tempactive) if (hunk_tempactive)
@ -524,7 +524,7 @@ void *Hunk_HighAllocName(int size, const char *name)
if (hunk_size - hunk_high_used - hunk_low_used < size) if (hunk_size - hunk_high_used - hunk_low_used < size)
{ {
Con_Printf(__FUNCTION__ ": failed on %i bytes\n", size); Con_Printf("%s: failed on %i bytes\n", __func__, size);
return 0; return 0;
} }
@ -675,7 +675,7 @@ void Cache_UnlinkLRU(cache_system_t *cs)
{ {
if (!cs->lru_next || !cs->lru_prev) if (!cs->lru_next || !cs->lru_prev)
{ {
Sys_Error(__FUNCTION__ ": NULL link"); Sys_Error("%s: NULL link", __func__);
} }
cs->lru_next->lru_prev = cs->lru_prev; cs->lru_next->lru_prev = cs->lru_prev;
@ -687,7 +687,7 @@ void Cache_MakeLRU(cache_system_t *cs)
{ {
if (cs->lru_next || cs->lru_prev) if (cs->lru_next || cs->lru_prev)
{ {
Sys_Error(__FUNCTION__ ": active link"); Sys_Error("%s: active link", __func__);
} }
cache_head.lru_next->lru_prev = cs; cache_head.lru_next->lru_prev = cs;
@ -714,7 +714,7 @@ cache_system_t *Cache_TryAlloc(int size, qboolean nobottom)
{ {
if (hunk_size - hunk_low_used - hunk_high_used < size) if (hunk_size - hunk_low_used - hunk_high_used < size)
{ {
Sys_Error(__FUNCTION__ ": %i is greater then free hunk", size); Sys_Error("%s: %i is greater then free hunk", __func__, size);
} }
newmem = (cache_system_t *)(hunk_base + hunk_low_used); newmem = (cache_system_t *)(hunk_base + hunk_low_used);
@ -955,7 +955,7 @@ void Cache_Free(cache_user_t *c)
{ {
if (!c->data) if (!c->data)
{ {
Sys_Error(__FUNCTION__ ": not allocated"); Sys_Error("%s: not allocated", __func__);
} }
cache_system_t *cs = ((cache_system_t *)c->data - 1); cache_system_t *cs = ((cache_system_t *)c->data - 1);
@ -1012,12 +1012,12 @@ void *Cache_Alloc(cache_user_t *c, int size, char *name)
if (c->data) if (c->data)
{ {
Sys_Error(__FUNCTION__ ": already allocated"); Sys_Error("%s: already allocated", __func__);
} }
if (size <= 0) if (size <= 0)
{ {
Sys_Error(__FUNCTION__ ": size %i", size); Sys_Error("%s: size %i", __func__, size);
} }
while (true) while (true)
@ -1036,7 +1036,7 @@ void *Cache_Alloc(cache_user_t *c, int size, char *name)
if (cache_head.lru_prev == &cache_head) if (cache_head.lru_prev == &cache_head)
{ {
Sys_Error(__FUNCTION__ ": out of memory"); Sys_Error("%s: out of memory", __func__);
} }
Cache_Free(cache_head.lru_prev->user); Cache_Free(cache_head.lru_prev->user);
@ -1072,7 +1072,7 @@ void Memory_Init(void *buf, int size)
} }
else else
{ {
Sys_Error(__FUNCTION__ ": you must specify a size in KB after -zone"); Sys_Error("%s: you must specify a size in KB after -zone", __func__);
} }
} }

View File

@ -44,7 +44,7 @@ void *GetOriginalFuncAddrOrDie(const char *funcName)
return (void*) cfh->originalAddress; return (void*) cfh->originalAddress;
} }
rehlds_syserror("%s: Could not find function '%s'", __FUNCTION__, funcName); rehlds_syserror("%s: Could not find function '%s'", __func__, funcName);
return NULL; return NULL;
} }
@ -67,7 +67,7 @@ void *GetFuncRefAddrOrDie(const char *funcName)
return (void*)cfh->originalAddress; return (void*)cfh->originalAddress;
} }
rehlds_syserror("%s: Could not find function '%s'", __FUNCTION__, funcName); rehlds_syserror("%s: Could not find function '%s'", __func__, funcName);
return NULL; return NULL;
} }
@ -98,7 +98,7 @@ int HookEngine(size_t addr)
if (!GetAddress(&g_EngineModule, (Address*)refData, g_BaseOffset)) if (!GetAddress(&g_EngineModule, (Address*)refData, g_BaseOffset))
{ {
#if _DEBUG #if _DEBUG
printf("%s: symbol not found \"%s\", symbol index: %i\n", __FUNCTION__, refData->symbolName, refData->symbolIndex); printf("%s: symbol not found \"%s\", symbol index: %i\n", __func__, refData->symbolName, refData->symbolIndex);
success = false; success = false;
#endif #endif
} }
@ -111,7 +111,7 @@ int HookEngine(size_t addr)
if (!GetAddress(&g_EngineModule, (Address*)refFunc, g_BaseOffset)) if (!GetAddress(&g_EngineModule, (Address*)refFunc, g_BaseOffset))
{ {
#if _DEBUG #if _DEBUG
printf("%s: symbol not found \"%s\", symbol index: %i\n", __FUNCTION__, refData->symbolName, refData->symbolIndex); printf("%s: symbol not found \"%s\", symbol index: %i\n", __func__, refData->symbolName, refData->symbolIndex);
success = false; success = false;
#endif #endif
} }
@ -124,7 +124,7 @@ int HookEngine(size_t addr)
if (!GetAddress(&g_EngineModule, (Address*)hookFunc, g_BaseOffset)) if (!GetAddress(&g_EngineModule, (Address*)hookFunc, g_BaseOffset))
{ {
#if _DEBUG #if _DEBUG
printf("%s: symbol not found \"%s\", symbol index: %i\n", __FUNCTION__, refData->symbolName, refData->symbolIndex); printf("%s: symbol not found \"%s\", symbol index: %i\n", __func__, refData->symbolName, refData->symbolIndex);
success = false; success = false;
#endif #endif
} }
@ -134,7 +134,7 @@ int HookEngine(size_t addr)
if (!success) if (!success)
{ {
#if _DEBUG #if _DEBUG
printf("%s: failed to hook engine!\n", __FUNCTION__); printf("%s: failed to hook engine!\n", __func__);
#endif #endif
return (FALSE); return (FALSE);
} }

View File

@ -420,13 +420,13 @@ void ProcessModuleData(Module *module)
int i = 0; int i = 0;
PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)module->base; PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)module->base;
if (dosHeader->e_magic != IMAGE_DOS_SIGNATURE) { if (dosHeader->e_magic != IMAGE_DOS_SIGNATURE) {
rehlds_syserror(__FUNCTION__ ": Invalid DOS header signature"); rehlds_syserror("%s: Invalid DOS header signature", __func__);
return; return;
} }
PIMAGE_NT_HEADERS NTHeaders = (PIMAGE_NT_HEADERS)((size_t)module->base + dosHeader->e_lfanew); PIMAGE_NT_HEADERS NTHeaders = (PIMAGE_NT_HEADERS)((size_t)module->base + dosHeader->e_lfanew);
if (NTHeaders->Signature != 0x4550) { if (NTHeaders->Signature != 0x4550) {
rehlds_syserror(__FUNCTION__ ": Invalid NT header signature"); rehlds_syserror("%s: Invalid NT header signature", __func__);
return; return;
} }
@ -440,7 +440,7 @@ void ProcessModuleData(Module *module)
} }
if (CodeSection == NULL) { if (CodeSection == NULL) {
rehlds_syserror(__FUNCTION__ ": Code section not found"); rehlds_syserror("%s: Code section not found", __func__);
return; return;
} }

View File

@ -529,7 +529,6 @@
<ClInclude Include="..\public\steam\steam_gameserver.h" /> <ClInclude Include="..\public\steam\steam_gameserver.h" />
<ClInclude Include="..\public\string_t.h" /> <ClInclude Include="..\public\string_t.h" />
<ClInclude Include="..\public\tier0\dbg.h" /> <ClInclude Include="..\public\tier0\dbg.h" />
<ClInclude Include="..\public\tier0\fasttimer.h" />
<ClInclude Include="..\public\tier0\mem.h" /> <ClInclude Include="..\public\tier0\mem.h" />
<ClInclude Include="..\public\tier0\memalloc.h" /> <ClInclude Include="..\public\tier0\memalloc.h" />
<ClInclude Include="..\public\tier0\memdbgoff.h" /> <ClInclude Include="..\public\tier0\memdbgoff.h" />

View File

@ -765,9 +765,6 @@
<ClInclude Include="..\public\tier0\platform.h"> <ClInclude Include="..\public\tier0\platform.h">
<Filter>public\tier0</Filter> <Filter>public\tier0</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\public\tier0\fasttimer.h">
<Filter>public\tier0</Filter>
</ClInclude>
<ClInclude Include="..\public\tier0\dbg.h"> <ClInclude Include="..\public\tier0\dbg.h">
<Filter>public\tier0</Filter> <Filter>public\tier0</Filter>
</ClInclude> </ClInclude>

View File

@ -33,7 +33,7 @@ typedef void(*xcommand_t)(void);
typedef struct cmd_function_s typedef struct cmd_function_s
{ {
struct cmd_function_s *next; struct cmd_function_s *next;
char *name; const char *name;
xcommand_t function; xcommand_t function;
int flags; int flags;
} cmd_function_t; } cmd_function_t;

View File

@ -258,7 +258,7 @@ typedef struct enginefuncs_s
void (*pfnGetPlayerStats) ( const edict_t *pClient, int *ping, int *packet_loss ); void (*pfnGetPlayerStats) ( const edict_t *pClient, int *ping, int *packet_loss );
void (*pfnAddServerCommand) ( char *cmd_name, void (*function) (void) ); void (*pfnAddServerCommand) ( const char *cmd_name, void (*function) (void) );
// For voice communications, set which clients hear eachother. // For voice communications, set which clients hear eachother.
// NOTE: these functions take player entity indices (starting at 1). // NOTE: these functions take player entity indices (starting at 1).

View File

@ -79,9 +79,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/sysinfo.h> #include <sys/sysinfo.h>
#include <unistd.h> #include <unistd.h>
// Deail with stupid macro in kernel.h
#undef __FUNCTION__
#endif // _WIN32 #endif // _WIN32
#include <string> #include <string>
@ -92,7 +89,13 @@
#include <smmintrin.h> #include <smmintrin.h>
#include <xmmintrin.h> #include <xmmintrin.h>
#ifdef _WIN32 // WINDOWS #ifdef _WIN32 // WINDOWS
// Define __func__ on VS less than 2015
#if _MSC_VER < 1900
#define __func__ __FUNCTION__
#endif
#define _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
@ -106,6 +109,10 @@
#define NORETURN __declspec(noreturn) #define NORETURN __declspec(noreturn)
#define FORCE_STACK_ALIGN #define FORCE_STACK_ALIGN
#define __builtin_bswap16 _byteswap_ushort
#define __builtin_bswap32 _byteswap_ulong
#define __builtin_bswap64 _byteswap_uint64
//inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctlsocket(s, FIONBIO, (u_long*)&m) == 0); } //inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctlsocket(s, FIONBIO, (u_long*)&m) == 0); }
//inline int SOCKET_MSGLEN(SOCKET s, u_long& r) { return ioctlsocket(s, FIONREAD, (u_long*)&r); } //inline int SOCKET_MSGLEN(SOCKET s, u_long& r) { return ioctlsocket(s, FIONREAD, (u_long*)&r); }
typedef int socklen_t; typedef int socklen_t;
@ -124,11 +131,6 @@
VirtualFree(ptr, 0, MEM_RELEASE); VirtualFree(ptr, 0, MEM_RELEASE);
} }
#else // _WIN32 #else // _WIN32
#ifdef __FUNCTION__
#undef __FUNCTION__
#endif
#define __FUNCTION__ __func__
#ifndef PAGESIZE #ifndef PAGESIZE
#define PAGESIZE 4096 #define PAGESIZE 4096
#endif #endif
@ -152,6 +154,12 @@
#define NORETURN __attribute__((noreturn)) #define NORETURN __attribute__((noreturn))
#define FORCE_STACK_ALIGN __attribute__((force_align_arg_pointer)) #define FORCE_STACK_ALIGN __attribute__((force_align_arg_pointer))
#if defined __INTEL_COMPILER
#define __builtin_bswap16 _bswap16
#define __builtin_bswap32 _bswap
#define __builtin_bswap64 _bswap64
#endif // __INTEL_COMPILER
//inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctl(s, FIONBIO, (int*)&m) == 0); } //inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctl(s, FIONBIO, (int*)&m) == 0); }
//inline int SOCKET_MSGLEN(SOCKET s, u_long& r) { return ioctl(s, FIONREAD, (int*)&r); } //inline int SOCKET_MSGLEN(SOCKET s, u_long& r) { return ioctl(s, FIONREAD, (int*)&r); }
typedef int SOCKET; typedef int SOCKET;
@ -191,4 +199,8 @@
#define EXT_FUNC FORCE_STACK_ALIGN #define EXT_FUNC FORCE_STACK_ALIGN
// Used to obtain the string name of a variable.
#define nameof_variable(name) template_nameof_variable(name, #name)
template <typename T> const char* template_nameof_variable(const T& /*validate_type*/, const char* name) { return name; }
#endif // _OSCONFIG_H #endif // _OSCONFIG_H

View File

@ -282,7 +282,7 @@ struct RehldsFuncs_t {
bool(*SV_EmitSound2)(edict_t *entity, IGameClient *receiver, int channel, const char *sample, float volume, float attenuation, int flags, int pitch, int emitFlags, const float *pOrigin); bool(*SV_EmitSound2)(edict_t *entity, IGameClient *receiver, int channel, const char *sample, float volume, float attenuation, int flags, int pitch, int emitFlags, const float *pOrigin);
void(*SV_UpdateUserInfo)(IGameClient *pGameClient); void(*SV_UpdateUserInfo)(IGameClient *pGameClient);
bool(*StripUnprintableAndSpace)(char *pch); bool(*StripUnprintableAndSpace)(char *pch);
void(*Cmd_RemoveCmd)(char *cmd_name); void(*Cmd_RemoveCmd)(const char *cmd_name);
}; };
class IRehldsApi { class IRehldsApi {

View File

@ -44,7 +44,7 @@ private:
// this was a root node // this was a root node
unsigned int rootId = GetRoodNodeId(node->key); unsigned int rootId = GetRoodNodeId(node->key);
if (m_RootNodes[rootId] != node) { if (m_RootNodes[rootId] != node) {
Sys_Error(__FUNCTION__ ": invalid root node"); Sys_Error("%s: invalid root node", __func__);
return; return;
} }

View File

@ -1,424 +0,0 @@
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef FASTTIMER_H
#define FASTTIMER_H
#ifdef _WIN32
#pragma once
#endif
#include "osconfig.h"
#include "tier0/platform.h"
PLATFORM_INTERFACE __int64 g_ClockSpeed;
PLATFORM_INTERFACE unsigned long g_dwClockSpeed;
PLATFORM_INTERFACE double g_ClockSpeedMicrosecondsMultiplier;
PLATFORM_INTERFACE double g_ClockSpeedMillisecondsMultiplier;
PLATFORM_INTERFACE double g_ClockSpeedSecondsMultiplier;
class CCycleCount
{
friend class CFastTimer;
public:
CCycleCount();
void Sample(); // Sample the clock. This takes about 34 clocks to execute (or 26,000 calls per millisecond on a P900).
void Init(); // Set to zero.
void Init(float initTimeMsec);
bool IsLessThan(CCycleCount const &other) const; // Compare two counts.
// Convert to other time representations. These functions are slow, so it's preferable to call them
// during display rather than inside a timing block.
unsigned long GetCycles() const;
unsigned long GetMicroseconds() const;
double GetMicrosecondsF() const;
unsigned long GetMilliseconds() const;
double GetMillisecondsF() const;
double GetSeconds() const;
CCycleCount& operator+=(CCycleCount const &other);
// dest = rSrc1 + rSrc2
static void Add(CCycleCount const &rSrc1, CCycleCount const &rSrc2, CCycleCount &dest); // Add two samples together.
// dest = rSrc1 - rSrc2
static void Sub(CCycleCount const &rSrc1, CCycleCount const &rSrc2, CCycleCount &dest); // Add two samples together.
__int64 m_Int64;
};
class CClockSpeedInit
{
public:
CClockSpeedInit()
{
Init();
}
static void Init()
{
const CPUInformation& pi = GetCPUInformation();
g_ClockSpeed = pi.m_Speed;
g_dwClockSpeed = (unsigned long)g_ClockSpeed;
g_ClockSpeedMicrosecondsMultiplier = 1000000.0 / (double)g_ClockSpeed;
g_ClockSpeedMillisecondsMultiplier = 1000.0 / (double)g_ClockSpeed;
g_ClockSpeedSecondsMultiplier = 1.0f / (double)g_ClockSpeed;
}
};
class CFastTimer
{
public:
// These functions are fast to call and should be called from your sampling code.
void Start();
void End();
const CCycleCount & GetDuration() const; // Get the elapsed time between Start and End calls.
CCycleCount GetDurationInProgress() const; // Call without ending. Not that cheap.
// Return number of cycles per second on this processor.
static inline unsigned long GetClockSpeed();
private:
CCycleCount m_Duration;
};
// This is a helper class that times whatever block of code it's in
class CTimeScope
{
public:
CTimeScope(CFastTimer *pTimer);
~CTimeScope();
private:
CFastTimer *m_pTimer;
};
inline CTimeScope::CTimeScope(CFastTimer *pTotal)
{
m_pTimer = pTotal;
m_pTimer->Start();
}
inline CTimeScope::~CTimeScope()
{
m_pTimer->End();
}
// This is a helper class that times whatever block of code it's in and
// adds the total (int microseconds) to a global counter.
class CTimeAdder
{
public:
CTimeAdder(CCycleCount *pTotal);
~CTimeAdder();
void End();
private:
CCycleCount *m_pTotal;
CFastTimer m_Timer;
};
inline CTimeAdder::CTimeAdder(CCycleCount *pTotal)
{
m_pTotal = pTotal;
m_Timer.Start();
}
inline CTimeAdder::~CTimeAdder()
{
End();
}
inline void CTimeAdder::End()
{
if (m_pTotal)
{
m_Timer.End();
*m_pTotal += m_Timer.GetDuration();
m_pTotal = 0;
}
}
// -------------------------------------------------------------------------- //
// Simple tool to support timing a block of code, and reporting the results on
// program exit
// -------------------------------------------------------------------------- //
#define PROFILE_SCOPE(name) \
class C##name##ACC : public CAverageCycleCounter \
{ \
public: \
~C##name##ACC() \
{ \
Msg("%-48s: %6.3f avg (%8.1f total, %7.3f peak, %5d iters)\n", \
#name, \
GetAverageMilliseconds(), \
GetTotalMilliseconds(), \
GetPeakMilliseconds(), \
GetIters() ); \
} \
}; \
static C##name##ACC name##_ACC; \
CAverageTimeMarker name##_ATM( &name##_ACC )
// -------------------------------------------------------------------------- //
class CAverageCycleCounter
{
public:
CAverageCycleCounter();
void Init();
void MarkIter(const CCycleCount &duration);
unsigned GetIters() const;
double GetAverageMilliseconds() const;
double GetTotalMilliseconds() const;
double GetPeakMilliseconds() const;
private:
unsigned m_nIters;
CCycleCount m_Total;
CCycleCount m_Peak;
bool m_fReport;
const char *m_pszName;
};
// -------------------------------------------------------------------------- //
class CAverageTimeMarker
{
public:
CAverageTimeMarker(CAverageCycleCounter *pCounter);
~CAverageTimeMarker();
private:
CAverageCycleCounter *m_pCounter;
CFastTimer m_Timer;
};
// -------------------------------------------------------------------------- //
// CCycleCount inlines.
// -------------------------------------------------------------------------- //
inline CCycleCount::CCycleCount()
{
m_Int64 = 0;
}
inline void CCycleCount::Init()
{
m_Int64 = 0;
}
inline void CCycleCount::Init(float initTimeMsec)
{
if (g_ClockSpeedMillisecondsMultiplier > 0)
m_Int64 = initTimeMsec / g_ClockSpeedMillisecondsMultiplier;
else
m_Int64 = 0;
}
inline void CCycleCount::Sample()
{
unsigned long* pSample = (unsigned long *)&m_Int64;
__asm
{
// force the cpu to synchronize the instruction queue
// NJS: CPUID can really impact performance in tight loops.
//cpuid
//cpuid
//cpuid
mov ecx, pSample
rdtsc
mov[ecx], eax
mov[ecx + 4], edx
}
}
inline CCycleCount& CCycleCount::operator+=(CCycleCount const &other)
{
m_Int64 += other.m_Int64;
return *this;
}
inline void CCycleCount::Add(CCycleCount const &rSrc1, CCycleCount const &rSrc2, CCycleCount &dest)
{
dest.m_Int64 = rSrc1.m_Int64 + rSrc2.m_Int64;
}
inline void CCycleCount::Sub(CCycleCount const &rSrc1, CCycleCount const &rSrc2, CCycleCount &dest)
{
dest.m_Int64 = rSrc1.m_Int64 - rSrc2.m_Int64;
}
inline bool CCycleCount::IsLessThan(CCycleCount const &other) const
{
return m_Int64 < other.m_Int64;
}
inline unsigned long CCycleCount::GetCycles() const
{
return (unsigned long)m_Int64;
}
inline unsigned long CCycleCount::GetMicroseconds() const
{
return (unsigned long)((m_Int64 * 1000000) / g_ClockSpeed);
}
inline double CCycleCount::GetMicrosecondsF() const
{
return (double)(m_Int64 * g_ClockSpeedMicrosecondsMultiplier);
}
inline unsigned long CCycleCount::GetMilliseconds() const
{
return (unsigned long)((m_Int64 * 1000) / g_ClockSpeed);
}
inline double CCycleCount::GetMillisecondsF() const
{
return (double)(m_Int64 * g_ClockSpeedMillisecondsMultiplier);
}
inline double CCycleCount::GetSeconds() const
{
return (double)(m_Int64 * g_ClockSpeedSecondsMultiplier);
}
// -------------------------------------------------------------------------- //
// CFastTimer inlines.
// -------------------------------------------------------------------------- //
inline void CFastTimer::Start()
{
m_Duration.Sample();
}
inline void CFastTimer::End()
{
CCycleCount cnt;
cnt.Sample();
m_Duration.m_Int64 = cnt.m_Int64 - m_Duration.m_Int64;
}
inline CCycleCount CFastTimer::GetDurationInProgress() const
{
CCycleCount cnt;
cnt.Sample();
CCycleCount result;
result.m_Int64 = cnt.m_Int64 - m_Duration.m_Int64;
return result;
}
inline unsigned long CFastTimer::GetClockSpeed()
{
return g_dwClockSpeed;
}
inline CCycleCount const& CFastTimer::GetDuration() const
{
return m_Duration;
}
// -------------------------------------------------------------------------- //
// CAverageCycleCounter inlines
inline CAverageCycleCounter::CAverageCycleCounter()
: m_nIters(0)
{
}
inline void CAverageCycleCounter::Init()
{
m_Total.Init();
m_Peak.Init();
m_nIters = 0;
}
inline void CAverageCycleCounter::MarkIter(const CCycleCount &duration)
{
++m_nIters;
m_Total += duration;
if (m_Peak.IsLessThan(duration))
m_Peak = duration;
}
inline unsigned CAverageCycleCounter::GetIters() const
{
return m_nIters;
}
inline double CAverageCycleCounter::GetAverageMilliseconds() const
{
if (m_nIters)
return (m_Total.GetMillisecondsF() / (double)m_nIters);
else
return 0;
}
inline double CAverageCycleCounter::GetTotalMilliseconds() const
{
return m_Total.GetMillisecondsF();
}
inline double CAverageCycleCounter::GetPeakMilliseconds() const
{
return m_Peak.GetMillisecondsF();
}
// -------------------------------------------------------------------------- //
inline CAverageTimeMarker::CAverageTimeMarker(CAverageCycleCounter *pCounter)
{
m_pCounter = pCounter;
m_Timer.Start();
}
inline CAverageTimeMarker::~CAverageTimeMarker()
{
m_Timer.End();
m_pCounter->MarkIter(m_Timer.GetDuration());
}
#endif // FASTTIMER_H

View File

@ -456,7 +456,7 @@ PLATFORM_INTERFACE bool Plat_FastVerifyHardwareKey();
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Include additional dependant header components. // Include additional dependant header components.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#include "tier0/fasttimer.h" //#include "tier0/fasttimer.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -606,7 +606,7 @@ struct __MetaLooper_##NAME<0> \
class NAME \ class NAME \
{ \ { \
private: \ private: \
static const __MetaLooper_##NAME<COUNT> m; \ static const __MetaLooper_##NAME<COUNT> m; \
public: \ public: \
enum { count = COUNT }; \ enum { count = COUNT }; \
static const __Type_##NAME* functions; \ static const __Type_##NAME* functions; \

View File

@ -22,7 +22,7 @@ CRehldsFlightRecorder::CRehldsFlightRecorder() {
m_DataRegion = (uint8*) sys_allocmem(DATA_REGION_SIZE); m_DataRegion = (uint8*) sys_allocmem(DATA_REGION_SIZE);
if (!m_MetaRegion || !m_DataRegion) { if (!m_MetaRegion || !m_DataRegion) {
Sys_Error(__FUNCTION__ ": direct allocation failed"); Sys_Error("%s: direct allocation failed", __func__);
} }
//initialize meta region header //initialize meta region header
@ -36,7 +36,7 @@ CRehldsFlightRecorder::CRehldsFlightRecorder() {
metaPos += sizeof(recorder_state); metaPos += sizeof(recorder_state);
if ((metaPos - (char*)m_MetaRegion) > META_REGION_HEADER) { if ((metaPos - (char*)m_MetaRegion) > META_REGION_HEADER) {
Sys_Error(__FUNCTION__ ": Meta header overflow"); Sys_Error("%s: Meta header overflow", __func__);
} }
//initialize data region header //initialize data region header
@ -48,7 +48,7 @@ CRehldsFlightRecorder::CRehldsFlightRecorder() {
dataPos += sizeof(data_header); dataPos += sizeof(data_header);
if ((dataPos - (char*)m_pDataHeader) > DATA_REGION_HEADER) { if ((dataPos - (char*)m_pDataHeader) > DATA_REGION_HEADER) {
Sys_Error(__FUNCTION__ ": Data header overflow"); Sys_Error("%s: Data header overflow", __func__);
} }
InitHeadersContent(); InitHeadersContent();
@ -93,7 +93,7 @@ void CRehldsFlightRecorder::MoveToStart() {
void CRehldsFlightRecorder::StartMessage(uint16 msg, bool entrance) { void CRehldsFlightRecorder::StartMessage(uint16 msg, bool entrance) {
if (msg == 0 || msg > m_pMetaHeader->numMessages) { if (msg == 0 || msg > m_pMetaHeader->numMessages) {
Sys_Error(__FUNCTION__ ": Invalid message id %u", msg); Sys_Error("%s: Invalid message id %u", __func__, msg);
} }
if (entrance) { if (entrance) {
@ -101,7 +101,7 @@ void CRehldsFlightRecorder::StartMessage(uint16 msg, bool entrance) {
} }
if (m_pRecorderState->curMessage != 0) { if (m_pRecorderState->curMessage != 0) {
Sys_Error(__FUNCTION__ ": overlapping messages"); Sys_Error("%s: overlapping messages", __func__);
} }
unsigned int sz = DATA_REGION_MAIN_SIZE - m_pRecorderState->wpos; unsigned int sz = DATA_REGION_MAIN_SIZE - m_pRecorderState->wpos;
@ -121,7 +121,7 @@ void CRehldsFlightRecorder::EndMessage(uint16 msg, bool entrance) {
} }
if (m_pRecorderState->curMessage != msg) { if (m_pRecorderState->curMessage != msg) {
Sys_Error(__FUNCTION__ ": invalid message %u", msg); Sys_Error("%s: invalid message %u", __func__, msg);
} }
unsigned int freeSz = DATA_REGION_MAIN_SIZE - m_pRecorderState->wpos; unsigned int freeSz = DATA_REGION_MAIN_SIZE - m_pRecorderState->wpos;
@ -131,7 +131,7 @@ void CRehldsFlightRecorder::EndMessage(uint16 msg, bool entrance) {
unsigned int msgSize = m_pRecorderState->wpos - m_pRecorderState->lastMsgBeginPos; unsigned int msgSize = m_pRecorderState->wpos - m_pRecorderState->lastMsgBeginPos;
if (msgSize > MSG_MAX_SIZE) { if (msgSize > MSG_MAX_SIZE) {
Sys_Error(__FUNCTION__ ": too big message %u; size %u", msg, msgSize); Sys_Error("%s: too big message %u; size %u", __func__, msg, msgSize);
} }
*(uint16*)(m_DataRegionPtr + m_pRecorderState->wpos) = msgSize; *(uint16*)(m_DataRegionPtr + m_pRecorderState->wpos) = msgSize;
m_pRecorderState->wpos += 2; m_pRecorderState->wpos += 2;
@ -142,13 +142,13 @@ void CRehldsFlightRecorder::EndMessage(uint16 msg, bool entrance) {
void CRehldsFlightRecorder::CheckSize(unsigned int wantToWriteLen) { void CRehldsFlightRecorder::CheckSize(unsigned int wantToWriteLen) {
unsigned int msgSize = m_pRecorderState->wpos - m_pRecorderState->lastMsgBeginPos; unsigned int msgSize = m_pRecorderState->wpos - m_pRecorderState->lastMsgBeginPos;
if (msgSize + wantToWriteLen > MSG_MAX_SIZE) { if (msgSize + wantToWriteLen > MSG_MAX_SIZE) {
Sys_Error(__FUNCTION__ ": too big message %u; size %u", m_pRecorderState->curMessage, msgSize); Sys_Error("%s: too big message %u; size %u", __func__, m_pRecorderState->curMessage, msgSize);
} }
} }
void CRehldsFlightRecorder::WriteBuffer(const void* data, unsigned int len) { void CRehldsFlightRecorder::WriteBuffer(const void* data, unsigned int len) {
if (m_pRecorderState->curMessage == 0) { if (m_pRecorderState->curMessage == 0) {
Sys_Error(__FUNCTION__ ": Could not write, invalid state"); Sys_Error("%s: Could not write, invalid state", __func__);
} }
CheckSize(len); CheckSize(len);
@ -207,7 +207,7 @@ void CRehldsFlightRecorder::WriteDouble(double v) {
uint16 CRehldsFlightRecorder::RegisterMessage(const char* module, const char *message, unsigned int version, bool inOut) { uint16 CRehldsFlightRecorder::RegisterMessage(const char* module, const char *message, unsigned int version, bool inOut) {
if (m_pMetaHeader->numMessages >= MSG_MAX_ID) { if (m_pMetaHeader->numMessages >= MSG_MAX_ID) {
Sys_Error(__FUNCTION__ ": can't register message; limit exceeded"); Sys_Error("%s: can't register message; limit exceeded", __func__);
} }
uint16 msgId = ++m_pMetaHeader->numMessages; uint16 msgId = ++m_pMetaHeader->numMessages;

View File

@ -79,7 +79,7 @@ private:
template<typename T> template<typename T>
void WritePrimitive(T v) { void WritePrimitive(T v) {
if (m_pRecorderState->curMessage == 0) { if (m_pRecorderState->curMessage == 0) {
Sys_Error(__FUNCTION__ ": Could not write, invalid state"); Sys_Error("%s: Could not write, invalid state", __func__);
} }
CheckSize(sizeof(T)); CheckSize(sizeof(T));

View File

@ -11,7 +11,7 @@ CRehldsRuntimeConfig::CRehldsRuntimeConfig()
void CRehldsRuntimeConfig::parseFromCommandLine(const char* cmdLine) { void CRehldsRuntimeConfig::parseFromCommandLine(const char* cmdLine) {
char localBuf[2048]; char localBuf[2048];
if (strlen(cmdLine) >= sizeof(localBuf)) rehlds_syserror("%s: too long cmdline", __FUNCTION__); if (strlen(cmdLine) >= sizeof(localBuf)) rehlds_syserror("%s: too long cmdline", __func__);
strcpy(localBuf, cmdLine); strcpy(localBuf, cmdLine);
char* cpos = localBuf; char* cpos = localBuf;
@ -23,7 +23,7 @@ void CRehldsRuntimeConfig::parseFromCommandLine(const char* cmdLine) {
if (!strcmp(token, "--rehlds-test-record")) if (!strcmp(token, "--rehlds-test-record"))
{ {
const char* fname = getNextToken(&cpos); const char* fname = getNextToken(&cpos);
if (fname == NULL) rehlds_syserror("%s: usage: --rehlds-test-record <filename>", __FUNCTION__); if (fname == NULL) rehlds_syserror("%s: usage: --rehlds-test-record <filename>", __func__);
strncpy(testRecordingFileName, fname, sizeof(testRecordingFileName)); strncpy(testRecordingFileName, fname, sizeof(testRecordingFileName));
testRecordingFileName[sizeof(testRecordingFileName) - 1] = 0; testRecordingFileName[sizeof(testRecordingFileName) - 1] = 0;
testPlayerMode = TPM_RECORD; testPlayerMode = TPM_RECORD;
@ -31,7 +31,7 @@ void CRehldsRuntimeConfig::parseFromCommandLine(const char* cmdLine) {
else if (!strcmp(token, "--rehlds-test-play")) else if (!strcmp(token, "--rehlds-test-play"))
{ {
const char* fname = getNextToken(&cpos); const char* fname = getNextToken(&cpos);
if (fname == NULL) rehlds_syserror("%s: usage: --rehlds-test-play <filename>", __FUNCTION__); if (fname == NULL) rehlds_syserror("%s: usage: --rehlds-test-play <filename>", __func__);
strncpy(testRecordingFileName, fname, sizeof(testRecordingFileName)); strncpy(testRecordingFileName, fname, sizeof(testRecordingFileName));
testRecordingFileName[sizeof(testRecordingFileName) - 1] = 0; testRecordingFileName[sizeof(testRecordingFileName) - 1] = 0;
testPlayerMode = TPM_PLAY; testPlayerMode = TPM_PLAY;
@ -39,7 +39,7 @@ void CRehldsRuntimeConfig::parseFromCommandLine(const char* cmdLine) {
else if (!strcmp(token, "--rehlds-test-anon")) else if (!strcmp(token, "--rehlds-test-anon"))
{ {
const char* fname = getNextToken(&cpos); const char* fname = getNextToken(&cpos);
if (fname == NULL) rehlds_syserror("%s: usage: --rehlds-test-anon <filename>", __FUNCTION__); if (fname == NULL) rehlds_syserror("%s: usage: --rehlds-test-anon <filename>", __func__);
strncpy(testRecordingFileName, fname, sizeof(testRecordingFileName)); strncpy(testRecordingFileName, fname, sizeof(testRecordingFileName));
testRecordingFileName[sizeof(testRecordingFileName) - 1] = 0; testRecordingFileName[sizeof(testRecordingFileName) - 1] = 0;
testPlayerMode = TPM_ANONYMIZE; testPlayerMode = TPM_ANONYMIZE;

View File

@ -40,11 +40,11 @@ bool AbstractHookChainRegistry::findHook(void* hookFunc) const
void AbstractHookChainRegistry::addHook(void* hookFunc, int priority) void AbstractHookChainRegistry::addHook(void* hookFunc, int priority)
{ {
if (!hookFunc) { if (!hookFunc) {
Sys_Error(__FUNCTION__ " Parameter hookFunc can't be a nullptr"); Sys_Error("%s: Parameter hookFunc can't be a nullptr", __func__);
} }
if (findHook(hookFunc)) { if (findHook(hookFunc)) {
Sys_Error(__FUNCTION__ " The same handler can't be used twice on the hookchain."); Sys_Error("%s: The same handler can't be used twice on the hookchain.", __func__);
} }
for (auto i = 0; i < MAX_HOOKS_IN_CHAIN; i++) for (auto i = 0; i < MAX_HOOKS_IN_CHAIN; i++)
@ -63,7 +63,7 @@ void AbstractHookChainRegistry::addHook(void* hookFunc, int priority)
} }
if (m_NumHooks >= MAX_HOOKS_IN_CHAIN) { if (m_NumHooks >= MAX_HOOKS_IN_CHAIN) {
Sys_Error(__FUNCTION__ " MAX_HOOKS_IN_CHAIN limit hit"); Sys_Error("%s: MAX_HOOKS_IN_CHAIN limit hit", __func__);
} }
m_NumHooks++; m_NumHooks++;

View File

@ -40,7 +40,7 @@ public:
IHookChainImpl(void** hooks, origfunc_t orig) : m_Hooks(hooks), m_OriginalFunc(orig) IHookChainImpl(void** hooks, origfunc_t orig) : m_Hooks(hooks), m_OriginalFunc(orig)
{ {
if (orig == NULL) if (orig == NULL)
Sys_Error(__FUNCTION__ ": Non-void HookChain without original function."); Sys_Error("%s: Non-void HookChain without original function.", __func__);
} }
virtual ~IHookChainImpl() {} virtual ~IHookChainImpl() {}

View File

@ -19,7 +19,7 @@ CSimplePlatform::CSimplePlatform() {
wsock = LoadLibraryA("wsock32.dll"); wsock = LoadLibraryA("wsock32.dll");
setsockopt_v11 = (setsockopt_proto)GetProcAddress(wsock, "setsockopt"); setsockopt_v11 = (setsockopt_proto)GetProcAddress(wsock, "setsockopt");
if (setsockopt_v11 == NULL) if (setsockopt_v11 == NULL)
rehlds_syserror("%s: setsockopt_v11 not found", __FUNCTION__); rehlds_syserror("%s: setsockopt_v11 not found", __func__);
#endif #endif
} }

View File

@ -163,7 +163,7 @@ bool EXT_FUNC CRehldsServerStatic::IsLogActive()
IGameClient* EXT_FUNC CRehldsServerStatic::GetClient(int id) IGameClient* EXT_FUNC CRehldsServerStatic::GetClient(int id)
{ {
if (id < 0 || id >= g_psvs.maxclients) if (id < 0 || id >= g_psvs.maxclients)
Sys_Error(__FUNCTION__": invalid id provided: %d", id); Sys_Error("%s: invalid id provided: %d", __func__, id);
return g_GameClients[id]; return g_GameClients[id];
} }
@ -171,7 +171,7 @@ IGameClient* EXT_FUNC CRehldsServerStatic::GetClient(int id)
client_t* EXT_FUNC CRehldsServerStatic::GetClient_t(int id) client_t* EXT_FUNC CRehldsServerStatic::GetClient_t(int id)
{ {
if (id < 0 || id >= g_psvs.maxclients) if (id < 0 || id >= g_psvs.maxclients)
Sys_Error(__FUNCTION__": invalid id provided: %d", id); Sys_Error("%s: invalid id provided: %d", __func__, id);
return &g_psvs.clients[id]; return &g_psvs.clients[id];
} }
@ -288,7 +288,7 @@ IGameClient* GetRehldsApiClient(client_t* cl)
int idx = cl - g_psvs.clients; int idx = cl - g_psvs.clients;
if (idx < 0 || idx >= g_psvs.maxclients) if (idx < 0 || idx >= g_psvs.maxclients)
{ {
Sys_Error(__FUNCTION__": Invalid client index %d", idx); Sys_Error("%s: Invalid client index %d", __func__, idx);
} }
return g_GameClients[idx]; return g_GameClients[idx];

View File

@ -16,7 +16,7 @@ void* CSteamCallbackAnonymizingWrapper::Anonymize(void* data) {
{ {
static GSClientApprove_t cbdata; static GSClientApprove_t cbdata;
cbdata = *(GSClientApprove_t*)data; cbdata = *(GSClientApprove_t*)data;
cbdata.m_SteamID = m_Anonymizer->Real2FakeSteamId(cbdata.m_SteamID, __FUNCTION__); cbdata.m_SteamID = m_Anonymizer->Real2FakeSteamId(cbdata.m_SteamID, __func__);
return &cbdata; return &cbdata;
} }
@ -24,7 +24,7 @@ void* CSteamCallbackAnonymizingWrapper::Anonymize(void* data) {
{ {
static GSClientDeny_t cbdata; static GSClientDeny_t cbdata;
cbdata = *(GSClientDeny_t*)data; cbdata = *(GSClientDeny_t*)data;
cbdata.m_SteamID = m_Anonymizer->Real2FakeSteamId(cbdata.m_SteamID, __FUNCTION__); cbdata.m_SteamID = m_Anonymizer->Real2FakeSteamId(cbdata.m_SteamID, __func__);
return &cbdata; return &cbdata;
} }
@ -32,7 +32,7 @@ void* CSteamCallbackAnonymizingWrapper::Anonymize(void* data) {
{ {
static GSClientKick_t cbdata; static GSClientKick_t cbdata;
cbdata = *(GSClientKick_t*)data; cbdata = *(GSClientKick_t*)data;
cbdata.m_SteamID = m_Anonymizer->Real2FakeSteamId(cbdata.m_SteamID, __FUNCTION__); cbdata.m_SteamID = m_Anonymizer->Real2FakeSteamId(cbdata.m_SteamID, __func__);
return &cbdata; return &cbdata;
} }
@ -42,22 +42,22 @@ void* CSteamCallbackAnonymizingWrapper::Anonymize(void* data) {
return data; return data;
default: default:
rehlds_syserror("%s: unsupported callback %u", __FUNCTION__, m_iCallback); rehlds_syserror("%s: unsupported callback %u", __func__, m_iCallback);
} }
return NULL; return NULL;
} }
void* CSteamCallbackAnonymizingWrapper::Anonymize(void* data, bool bIOFailure, SteamAPICall_t hSteamAPICall) { void* CSteamCallbackAnonymizingWrapper::Anonymize(void* data, bool bIOFailure, SteamAPICall_t hSteamAPICall) {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return NULL; return NULL;
} }
void CSteamCallbackAnonymizingWrapper::Run(void *pvParam) void CSteamCallbackAnonymizingWrapper::Run(void *pvParam)
{ {
if (m_Wrapped->GetICallback() != this->GetICallback()) rehlds_syserror("%s: iCallback desync", __FUNCTION__); if (m_Wrapped->GetICallback() != this->GetICallback()) rehlds_syserror("%s: iCallback desync", __func__);
if (m_Wrapped->GetFlags() != this->GetFlags()) rehlds_syserror("%s: flags desync", __FUNCTION__); if (m_Wrapped->GetFlags() != this->GetFlags()) rehlds_syserror("%s: flags desync", __func__);
m_Wrapped->Run(Anonymize(pvParam)); m_Wrapped->Run(Anonymize(pvParam));
this->SetFlags(m_Wrapped->GetFlags()); this->SetFlags(m_Wrapped->GetFlags());
@ -66,8 +66,8 @@ void CSteamCallbackAnonymizingWrapper::Run(void *pvParam)
void CSteamCallbackAnonymizingWrapper::Run(void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall) void CSteamCallbackAnonymizingWrapper::Run(void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall)
{ {
if (m_Wrapped->GetICallback() != this->GetICallback()) rehlds_syserror("%s: iCallback desync", __FUNCTION__); if (m_Wrapped->GetICallback() != this->GetICallback()) rehlds_syserror("%s: iCallback desync", __func__);
if (m_Wrapped->GetFlags() != this->GetFlags()) rehlds_syserror("%s: flags desync", __FUNCTION__); if (m_Wrapped->GetFlags() != this->GetFlags()) rehlds_syserror("%s: flags desync", __func__);
m_Wrapped->Run(Anonymize(pvParam, bIOFailure, hSteamAPICall), bIOFailure, hSteamAPICall); m_Wrapped->Run(Anonymize(pvParam, bIOFailure, hSteamAPICall), bIOFailure, hSteamAPICall);
this->SetFlags(m_Wrapped->GetFlags()); this->SetFlags(m_Wrapped->GetFlags());
@ -91,25 +91,25 @@ CSteamAppsAnonymizingWrapper::CSteamAppsAnonymizingWrapper(ISteamApps* original,
bool CSteamAppsAnonymizingWrapper::BIsSubscribed() bool CSteamAppsAnonymizingWrapper::BIsSubscribed()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
bool CSteamAppsAnonymizingWrapper::BIsLowViolence() bool CSteamAppsAnonymizingWrapper::BIsLowViolence()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
bool CSteamAppsAnonymizingWrapper::BIsCybercafe() bool CSteamAppsAnonymizingWrapper::BIsCybercafe()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
bool CSteamAppsAnonymizingWrapper::BIsVACBanned() bool CSteamAppsAnonymizingWrapper::BIsVACBanned()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
@ -121,82 +121,82 @@ const char* CSteamAppsAnonymizingWrapper::GetCurrentGameLanguage()
const char* CSteamAppsAnonymizingWrapper::GetAvailableGameLanguages() const char* CSteamAppsAnonymizingWrapper::GetAvailableGameLanguages()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return NULL; return NULL;
} }
bool CSteamAppsAnonymizingWrapper::BIsSubscribedApp(AppId_t appID) bool CSteamAppsAnonymizingWrapper::BIsSubscribedApp(AppId_t appID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
bool CSteamAppsAnonymizingWrapper::BIsDlcInstalled(AppId_t appID) bool CSteamAppsAnonymizingWrapper::BIsDlcInstalled(AppId_t appID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
uint32 CSteamAppsAnonymizingWrapper::GetEarliestPurchaseUnixTime(AppId_t nAppID) uint32 CSteamAppsAnonymizingWrapper::GetEarliestPurchaseUnixTime(AppId_t nAppID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return 0; return 0;
} }
bool CSteamAppsAnonymizingWrapper::BIsSubscribedFromFreeWeekend() bool CSteamAppsAnonymizingWrapper::BIsSubscribedFromFreeWeekend()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
int CSteamAppsAnonymizingWrapper::GetDLCCount() int CSteamAppsAnonymizingWrapper::GetDLCCount()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return 0; return 0;
} }
bool CSteamAppsAnonymizingWrapper::BGetDLCDataByIndex(int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize) bool CSteamAppsAnonymizingWrapper::BGetDLCDataByIndex(int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
void CSteamAppsAnonymizingWrapper::InstallDLC(AppId_t nAppID) void CSteamAppsAnonymizingWrapper::InstallDLC(AppId_t nAppID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void CSteamAppsAnonymizingWrapper::UninstallDLC(AppId_t nAppID) void CSteamAppsAnonymizingWrapper::UninstallDLC(AppId_t nAppID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void CSteamAppsAnonymizingWrapper::RequestAppProofOfPurchaseKey(AppId_t nAppID) void CSteamAppsAnonymizingWrapper::RequestAppProofOfPurchaseKey(AppId_t nAppID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
bool CSteamAppsAnonymizingWrapper::GetCurrentBetaName(char *pchName, int cchNameBufferSize) bool CSteamAppsAnonymizingWrapper::GetCurrentBetaName(char *pchName, int cchNameBufferSize)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
bool CSteamAppsAnonymizingWrapper::MarkContentCorrupt(bool bMissingFilesOnly) bool CSteamAppsAnonymizingWrapper::MarkContentCorrupt(bool bMissingFilesOnly)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
uint32 CSteamAppsAnonymizingWrapper::GetInstalledDepots(DepotId_t *pvecDepots, uint32 cMaxDepots) uint32 CSteamAppsAnonymizingWrapper::GetInstalledDepots(DepotId_t *pvecDepots, uint32 cMaxDepots)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return 0; return 0;
} }
uint32 CSteamAppsAnonymizingWrapper::GetAppInstallDir(AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize) uint32 CSteamAppsAnonymizingWrapper::GetAppInstallDir(AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return 0; return 0;
} }
@ -213,7 +213,7 @@ CSteamGameServerAnonymizingWrapper::CSteamGameServerAnonymizingWrapper(ISteamGam
bool CSteamGameServerAnonymizingWrapper::InitGameServer(uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString) bool CSteamGameServerAnonymizingWrapper::InitGameServer(uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
@ -239,7 +239,7 @@ void CSteamGameServerAnonymizingWrapper::SetDedicatedServer(bool bDedicated)
void CSteamGameServerAnonymizingWrapper::LogOn(const char *pszAccountName, const char *pszPassword) void CSteamGameServerAnonymizingWrapper::LogOn(const char *pszAccountName, const char *pszPassword)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void CSteamGameServerAnonymizingWrapper::LogOnAnonymous() void CSteamGameServerAnonymizingWrapper::LogOnAnonymous()
@ -303,12 +303,12 @@ void CSteamGameServerAnonymizingWrapper::SetPasswordProtected(bool bPasswordProt
void CSteamGameServerAnonymizingWrapper::SetSpectatorPort(uint16 unSpectatorPort) void CSteamGameServerAnonymizingWrapper::SetSpectatorPort(uint16 unSpectatorPort)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void CSteamGameServerAnonymizingWrapper::SetSpectatorServerName(const char *pszSpectatorServerName) void CSteamGameServerAnonymizingWrapper::SetSpectatorServerName(const char *pszSpectatorServerName)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void CSteamGameServerAnonymizingWrapper::ClearAllKeyValues() void CSteamGameServerAnonymizingWrapper::ClearAllKeyValues()
@ -323,25 +323,25 @@ void CSteamGameServerAnonymizingWrapper::SetKeyValue(const char *pKey, const cha
void CSteamGameServerAnonymizingWrapper::SetGameTags(const char *pchGameTags) void CSteamGameServerAnonymizingWrapper::SetGameTags(const char *pchGameTags)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void CSteamGameServerAnonymizingWrapper::SetGameData(const char *pchGameData) void CSteamGameServerAnonymizingWrapper::SetGameData(const char *pchGameData)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void CSteamGameServerAnonymizingWrapper::SetRegion(const char *pszRegion) void CSteamGameServerAnonymizingWrapper::SetRegion(const char *pszRegion)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
bool CSteamGameServerAnonymizingWrapper::SendUserConnectAndAuthenticate(uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser) bool CSteamGameServerAnonymizingWrapper::SendUserConnectAndAuthenticate(uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser)
{ {
uint32 realIp = m_Anonymizer->Fake2RealIp(ntohl(unIPClient), __FUNCTION__); uint32 realIp = m_Anonymizer->Fake2RealIp(ntohl(unIPClient), __func__);
bool res = m_Wrapped->SendUserConnectAndAuthenticate(htonl(realIp), pvAuthBlob, cubAuthBlobSize, pSteamIDUser); bool res = m_Wrapped->SendUserConnectAndAuthenticate(htonl(realIp), pvAuthBlob, cubAuthBlobSize, pSteamIDUser);
if (res) { if (res) {
*pSteamIDUser = m_Anonymizer->Real2FakeSteamId(*pSteamIDUser, __FUNCTION__); *pSteamIDUser = m_Anonymizer->Real2FakeSteamId(*pSteamIDUser, __func__);
} }
return res; return res;
} }
@ -354,14 +354,14 @@ CSteamID CSteamGameServerAnonymizingWrapper::CreateUnauthenticatedUserConnection
void CSteamGameServerAnonymizingWrapper::SendUserDisconnect(CSteamID steamIDUser) void CSteamGameServerAnonymizingWrapper::SendUserDisconnect(CSteamID steamIDUser)
{ {
CSteamID real = m_Anonymizer->Fake2RealSteamId(steamIDUser, __FUNCTION__); CSteamID real = m_Anonymizer->Fake2RealSteamId(steamIDUser, __func__);
m_Wrapped->SendUserDisconnect(real); m_Wrapped->SendUserDisconnect(real);
} }
bool CSteamGameServerAnonymizingWrapper::BUpdateUserData(CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore) bool CSteamGameServerAnonymizingWrapper::BUpdateUserData(CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore)
{ {
CSteamID real = steamIDUser.BAnonAccount() ? steamIDUser : m_Anonymizer->Fake2RealSteamId(steamIDUser, __FUNCTION__); CSteamID real = steamIDUser.BAnonAccount() ? steamIDUser : m_Anonymizer->Fake2RealSteamId(steamIDUser, __func__);
std::string realName = m_Anonymizer->Fake2RealName(pchPlayerName, __FUNCTION__); std::string realName = m_Anonymizer->Fake2RealName(pchPlayerName, __func__);
bool res = m_Wrapped->BUpdateUserData(real, realName.c_str(), uScore); bool res = m_Wrapped->BUpdateUserData(real, realName.c_str(), uScore);
return res; return res;
@ -369,58 +369,58 @@ bool CSteamGameServerAnonymizingWrapper::BUpdateUserData(CSteamID steamIDUser, c
HAuthTicket CSteamGameServerAnonymizingWrapper::GetAuthSessionTicket(void *pTicket, int cbMaxTicket, uint32 *pcbTicket) HAuthTicket CSteamGameServerAnonymizingWrapper::GetAuthSessionTicket(void *pTicket, int cbMaxTicket, uint32 *pcbTicket)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return k_HAuthTicketInvalid; return k_HAuthTicketInvalid;
} }
EBeginAuthSessionResult CSteamGameServerAnonymizingWrapper::BeginAuthSession(const void *pAuthTicket, int cbAuthTicket, CSteamID steamID) EBeginAuthSessionResult CSteamGameServerAnonymizingWrapper::BeginAuthSession(const void *pAuthTicket, int cbAuthTicket, CSteamID steamID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return k_EBeginAuthSessionResultInvalidTicket; return k_EBeginAuthSessionResultInvalidTicket;
} }
void CSteamGameServerAnonymizingWrapper::EndAuthSession(CSteamID steamID) void CSteamGameServerAnonymizingWrapper::EndAuthSession(CSteamID steamID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void CSteamGameServerAnonymizingWrapper::CancelAuthTicket(HAuthTicket hAuthTicket) void CSteamGameServerAnonymizingWrapper::CancelAuthTicket(HAuthTicket hAuthTicket)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
EUserHasLicenseForAppResult CSteamGameServerAnonymizingWrapper::UserHasLicenseForApp(CSteamID steamID, AppId_t appID) EUserHasLicenseForAppResult CSteamGameServerAnonymizingWrapper::UserHasLicenseForApp(CSteamID steamID, AppId_t appID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return k_EUserHasLicenseResultDoesNotHaveLicense; return k_EUserHasLicenseResultDoesNotHaveLicense;
} }
bool CSteamGameServerAnonymizingWrapper::RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup) bool CSteamGameServerAnonymizingWrapper::RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
void CSteamGameServerAnonymizingWrapper::GetGameplayStats() void CSteamGameServerAnonymizingWrapper::GetGameplayStats()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
SteamAPICall_t CSteamGameServerAnonymizingWrapper::GetServerReputation() SteamAPICall_t CSteamGameServerAnonymizingWrapper::GetServerReputation()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return k_uAPICallInvalid; return k_uAPICallInvalid;
} }
uint32 CSteamGameServerAnonymizingWrapper::GetPublicIP() uint32 CSteamGameServerAnonymizingWrapper::GetPublicIP()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return 0; return 0;
} }
bool CSteamGameServerAnonymizingWrapper::HandleIncomingPacket(const void *pData, int cbData, uint32 srcIP, uint16 srcPort) bool CSteamGameServerAnonymizingWrapper::HandleIncomingPacket(const void *pData, int cbData, uint32 srcIP, uint16 srcPort)
{ {
uint32 realIp = m_Anonymizer->Fake2RealIp(htonl(srcIP), __FUNCTION__); uint32 realIp = m_Anonymizer->Fake2RealIp(htonl(srcIP), __func__);
bool res; bool res;
if (m_Anonymizer->m_OriginalConnectPacketLen) { if (m_Anonymizer->m_OriginalConnectPacketLen) {
@ -438,7 +438,7 @@ int CSteamGameServerAnonymizingWrapper::GetNextOutgoingPacket(void *pOut, int cb
{ {
int res = m_Wrapped->GetNextOutgoingPacket(pOut, cbMaxOut, pNetAdr, pPort); int res = m_Wrapped->GetNextOutgoingPacket(pOut, cbMaxOut, pNetAdr, pPort);
if (res > 0) { if (res > 0) {
uint32 fakeIp = m_Anonymizer->Real2FakeIp(ntohl(*pNetAdr), __FUNCTION__); uint32 fakeIp = m_Anonymizer->Real2FakeIp(ntohl(*pNetAdr), __func__);
*pNetAdr = htonl(fakeIp); *pNetAdr = htonl(fakeIp);
//Clear players list //Clear players list
@ -466,18 +466,18 @@ void CSteamGameServerAnonymizingWrapper::SetHeartbeatInterval(int iHeartbeatInte
void CSteamGameServerAnonymizingWrapper::ForceHeartbeat() void CSteamGameServerAnonymizingWrapper::ForceHeartbeat()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
SteamAPICall_t CSteamGameServerAnonymizingWrapper::AssociateWithClan(CSteamID steamIDClan) SteamAPICall_t CSteamGameServerAnonymizingWrapper::AssociateWithClan(CSteamID steamIDClan)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return k_uAPICallInvalid; return k_uAPICallInvalid;
} }
SteamAPICall_t CSteamGameServerAnonymizingWrapper::ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer) SteamAPICall_t CSteamGameServerAnonymizingWrapper::ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return k_uAPICallInvalid; return k_uAPICallInvalid;
} }
@ -598,7 +598,7 @@ int CAnonymizingEngExtInterceptor::recvfrom(SOCKET s, char* buf, int len, int fl
{ {
int res = m_BasePlatform->recvfrom(s, buf, len, flags, from, fromlen); int res = m_BasePlatform->recvfrom(s, buf, len, flags, from, fromlen);
if (res > 0) { if (res > 0) {
Real2FakeSockaddr(from, __FUNCTION__); Real2FakeSockaddr(from, __func__);
if (res > 4 && (*(uint32*)buf) == 0xFFFFFFFF) { if (res > 4 && (*(uint32*)buf) == 0xFFFFFFFF) {
unsigned int localLen = res; unsigned int localLen = res;
ProcessConnectionlessPacket((uint8*)buf, &localLen); ProcessConnectionlessPacket((uint8*)buf, &localLen);
@ -613,7 +613,7 @@ int CAnonymizingEngExtInterceptor::sendto(SOCKET s, const char* buf, int len, in
sockaddr saddr; sockaddr saddr;
memcpy(&saddr, to, sizeof(sockaddr_in)); memcpy(&saddr, to, sizeof(sockaddr_in));
Fake2RealSockaddr(&saddr, __FUNCTION__); Fake2RealSockaddr(&saddr, __func__);
int res = m_BasePlatform->sendto(s, buf, len, flags, &saddr, tolen); int res = m_BasePlatform->sendto(s, buf, len, flags, &saddr, tolen);
return res; return res;
@ -639,7 +639,7 @@ int CAnonymizingEngExtInterceptor::WSAGetLastError()
struct hostent* CAnonymizingEngExtInterceptor::gethostbyname(const char *name) struct hostent* CAnonymizingEngExtInterceptor::gethostbyname(const char *name)
{ {
auto s = Fake2RealHost(name, __FUNCTION__); auto s = Fake2RealHost(name, __func__);
struct hostent* res = m_BasePlatform->gethostbyname(s.c_str()); struct hostent* res = m_BasePlatform->gethostbyname(s.c_str());
return res; return res;
} }
@ -648,7 +648,7 @@ int CAnonymizingEngExtInterceptor::gethostname(char *name, int namelen)
{ {
int res = m_BasePlatform->gethostname(name, namelen); int res = m_BasePlatform->gethostname(name, namelen);
if (res == 0) { if (res == 0) {
auto s = Real2FakeHost(name, __FUNCTION__); auto s = Real2FakeHost(name, __func__);
strncpy(name, s.c_str(), namelen); strncpy(name, s.c_str(), namelen);
name[namelen - 1] = 0; name[namelen - 1] = 0;
} }
@ -675,8 +675,8 @@ void CAnonymizingEngExtInterceptor::SteamAPI_RegisterCallback(CCallbackBase *pCa
{ {
CSteamCallbackAnonymizingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback); CSteamCallbackAnonymizingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback);
if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __FUNCTION__); if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __func__);
//if (wrappee->GetICallback() != pCallback->GetICallback()) rehlds_syserror("%s: flags desync", __FUNCTION__); //if (wrappee->GetICallback() != pCallback->GetICallback()) rehlds_syserror("%s: flags desync", __func__);
m_BasePlatform->SteamAPI_RegisterCallback(wrappee, iCallback); m_BasePlatform->SteamAPI_RegisterCallback(wrappee, iCallback);
@ -695,8 +695,8 @@ void CAnonymizingEngExtInterceptor::SteamAPI_UnregisterCallResult(class CCallbac
{ {
CSteamCallbackAnonymizingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback); CSteamCallbackAnonymizingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback);
if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __FUNCTION__); if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __func__);
if (wrappee->GetICallback() != pCallback->GetICallback()) rehlds_syserror("%s: flags desync", __FUNCTION__); if (wrappee->GetICallback() != pCallback->GetICallback()) rehlds_syserror("%s: flags desync", __func__);
m_BasePlatform->SteamAPI_UnregisterCallResult(wrappee, hAPICall); m_BasePlatform->SteamAPI_UnregisterCallResult(wrappee, hAPICall);
@ -768,8 +768,8 @@ void CAnonymizingEngExtInterceptor::SteamAPI_UnregisterCallback(CCallbackBase *p
{ {
CSteamCallbackAnonymizingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback); CSteamCallbackAnonymizingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback);
if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __FUNCTION__); if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __func__);
if (wrappee->GetICallback() != pCallback->GetICallback()) rehlds_syserror("%s: flags desync", __FUNCTION__); if (wrappee->GetICallback() != pCallback->GetICallback()) rehlds_syserror("%s: flags desync", __func__);
m_BasePlatform->SteamAPI_UnregisterCallback(wrappee); m_BasePlatform->SteamAPI_UnregisterCallback(wrappee);
@ -782,11 +782,11 @@ void CAnonymizingEngExtInterceptor::AnonymizeAddr(const char* real, const char*
netadr_t fakeAdr; netadr_t fakeAdr;
if (!NET_StringToAdr(real, &realAdr)) { if (!NET_StringToAdr(real, &realAdr)) {
rehlds_syserror("%s: Invalid address %s", __FUNCTION__, realAdr); rehlds_syserror("%s: Invalid address %s", __func__, realAdr);
} }
if (!NET_StringToAdr(fake, &fakeAdr)) { if (!NET_StringToAdr(fake, &fakeAdr)) {
rehlds_syserror("%s: Invalid address %s", __FUNCTION__, realAdr); rehlds_syserror("%s: Invalid address %s", __func__, realAdr);
} }
AnonymizeAddr(realAdr, fakeAdr); AnonymizeAddr(realAdr, fakeAdr);
@ -945,7 +945,7 @@ void CAnonymizingEngExtInterceptor::ProcessConnectPacket(uint8* data, unsigned i
bool isSteam = (3 == atoi(Info_ValueForKey(protinfo, "prot"))); bool isSteam = (3 == atoi(Info_ValueForKey(protinfo, "prot")));
std::string newName = Real2FakeName(Info_ValueForKey(origuserinfo, "name"), __FUNCTION__); std::string newName = Real2FakeName(Info_ValueForKey(origuserinfo, "name"), __func__);
Info_SetValueForKey(origuserinfo, "name", newName.c_str(), MAX_INFO_STRING); Info_SetValueForKey(origuserinfo, "name", newName.c_str(), MAX_INFO_STRING);
userinfo[0] = 0; userinfo[0] = 0;

View File

@ -40,7 +40,7 @@ void PrintBinaryArray(const char* data, int dataLen, std::stringstream &ss)
{ {
ss << "["; ss << "[";
for (int i = 0; i < dataLen; i++) for (int i = 0; i < dataLen; i++)
ss << " " << (unsigned int) (unsigned char)data[i]; ss << " " << (unsigned int)(unsigned char)data[i];
ss << "]"; ss << "]";
} }
@ -66,14 +66,14 @@ bool CompareSockAddrs(void* ps1, void* ps2) {
break; break;
default: default:
rehlds_syserror("%s: Unknown sockaddr family %u", __FUNCTION__, sa1->sa_family); rehlds_syserror("%s: Unknown sockaddr family %u", __func__, sa1->sa_family);
} }
return 0 == memcmp(ps1, ps2, compareSize); return 0 == memcmp(ps1, ps2, compareSize);
} }
/* ============================================================================ /* ============================================================================
CSleepExtCall CSleepExtCall
============================================================================ */ ============================================================================ */
CSleepExtCall::CSleepExtCall(DWORD time) CSleepExtCall::CSleepExtCall(DWORD time)
{ {
@ -109,7 +109,7 @@ void CSleepExtCall::readPrologue(std::istream &stream)
/* ============================================================================ /* ============================================================================
CQueryPerfFreqCall CQueryPerfFreqCall
============================================================================ */ ============================================================================ */
std::string CQueryPerfFreqCall::toString() std::string CQueryPerfFreqCall::toString()
{ {
@ -142,7 +142,7 @@ void CQueryPerfFreqCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CQueryPerfCounterCall CQueryPerfCounterCall
============================================================================ */ ============================================================================ */
std::string CQueryPerfCounterCall::toString() std::string CQueryPerfCounterCall::toString()
{ {
@ -176,7 +176,7 @@ void CQueryPerfCounterCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGetTickCountCall CGetTickCountCall
============================================================================ */ ============================================================================ */
std::string CGetTickCountCall::toString() std::string CGetTickCountCall::toString()
{ {
@ -207,7 +207,7 @@ void CGetTickCountCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGetTickCountCall CGetTickCountCall
============================================================================ */ ============================================================================ */
std::string CGetLocalTimeCall::toString() std::string CGetLocalTimeCall::toString()
@ -239,7 +239,7 @@ void CGetLocalTimeCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGetSystemTimeCall CGetSystemTimeCall
============================================================================ */ ============================================================================ */
std::string CGetSystemTimeCall::toString() std::string CGetSystemTimeCall::toString()
{ {
@ -270,7 +270,7 @@ void CGetSystemTimeCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGetTimeZoneInfoCall CGetTimeZoneInfoCall
============================================================================ */ ============================================================================ */
std::string CGetTimeZoneInfoCall::toString() std::string CGetTimeZoneInfoCall::toString()
{ {
@ -279,7 +279,7 @@ std::string CGetTimeZoneInfoCall::toString()
<< " Bias: " << m_Res.Bias << " Bias: " << m_Res.Bias
<< " StandardName: " << m_Res.StandardName << " StandardName: " << m_Res.StandardName
<< " StandardDate: "; PrintSystemTime(&m_Res.StandardDate, ss); << " StandardDate: "; PrintSystemTime(&m_Res.StandardDate, ss);
ss << " StandardBias: " << m_Res.StandardBias ss << " StandardBias: " << m_Res.StandardBias
<< " DaylightName: " << m_Res.DaylightName << " DaylightName: " << m_Res.DaylightName
<< " DaylightDate: "; PrintSystemTime(&m_Res.DaylightDate, ss); << " DaylightDate: "; PrintSystemTime(&m_Res.DaylightDate, ss);
@ -309,7 +309,7 @@ void CGetTimeZoneInfoCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CSocketCall CSocketCall
============================================================================ */ ============================================================================ */
CSocketCall::CSocketCall(int af, int type, int protocol) CSocketCall::CSocketCall(int af, int type, int protocol)
{ {
@ -364,7 +364,7 @@ void CSocketCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CIoCtlSocketCall CIoCtlSocketCall
============================================================================ */ ============================================================================ */
CIoCtlSocketCall::CIoCtlSocketCall(SOCKET s, long cmd, u_long inValue) CIoCtlSocketCall::CIoCtlSocketCall(SOCKET s, long cmd, u_long inValue)
{ {
@ -430,7 +430,7 @@ void CIoCtlSocketCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CSetSockOptCall CSetSockOptCall
============================================================================ */ ============================================================================ */
CSetSockOptCall::CSetSockOptCall(SOCKET s, int level, int optname, const char* optval, int optlen) CSetSockOptCall::CSetSockOptCall(SOCKET s, int level, int optname, const char* optval, int optlen)
{ {
@ -508,7 +508,7 @@ void CSetSockOptCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CCloseSocketCall CCloseSocketCall
============================================================================ */ ============================================================================ */
CCloseSocketCall::CCloseSocketCall(SOCKET s) CCloseSocketCall::CCloseSocketCall(SOCKET s)
{ {
@ -553,7 +553,7 @@ void CCloseSocketCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CRecvFromCall CRecvFromCall
============================================================================ */ ============================================================================ */
CRecvFromCall::CRecvFromCall(SOCKET s, int len, int flags, int fromlen) CRecvFromCall::CRecvFromCall(SOCKET s, int len, int flags, int fromlen)
{ {
@ -599,15 +599,15 @@ bool CRecvFromCall::compareInputArgs(IEngExtCall* other, bool strict)
void CRecvFromCall::setResult(const void* data, const void* from, int fromLen, int res) void CRecvFromCall::setResult(const void* data, const void* from, int fromLen, int res)
{ {
if (res > 0 && res > sizeof(m_Data)) if (res > 0 && res > sizeof(m_Data))
rehlds_syserror("%s: too large datalen (%d max %d)", __FUNCTION__, res, sizeof(m_Data)); rehlds_syserror("%s: too large datalen (%d max %d)", __func__, res, sizeof(m_Data));
if (fromLen > sizeof(m_From)) if (fromLen > sizeof(m_From))
rehlds_syserror("%s: too large fromlen (%d max %d)", __FUNCTION__, res, sizeof(m_From)); rehlds_syserror("%s: too large fromlen (%d max %d)", __func__, res, sizeof(m_From));
m_FromLenOut = fromLen; m_FromLenOut = fromLen;
m_Res = res; m_Res = res;
if (res > 0) if (res > 0)
memcpy(m_Data, data, res); memcpy(m_Data, data, res);
if (fromLen > 0) if (fromLen > 0)
@ -652,15 +652,15 @@ void CRecvFromCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CSendToCall CSendToCall
============================================================================ */ ============================================================================ */
CSendToCall::CSendToCall(SOCKET s, const void* buf, int len, int flags, const void* to, int tolen) CSendToCall::CSendToCall(SOCKET s, const void* buf, int len, int flags, const void* to, int tolen)
{ {
if (len > sizeof(m_Data)) if (len > sizeof(m_Data))
rehlds_syserror("%s: too large datalen (%d max %d)", __FUNCTION__, len, sizeof(m_Data)); rehlds_syserror("%s: too large datalen (%d max %d)", __func__, len, sizeof(m_Data));
if (tolen > sizeof(m_To)) if (tolen > sizeof(m_To))
rehlds_syserror("%s: too large tolen (%d max %d)", __FUNCTION__, tolen, sizeof(m_To)); rehlds_syserror("%s: too large tolen (%d max %d)", __func__, tolen, sizeof(m_To));
m_Socket = s; m_Socket = s;
m_Len = len; m_Len = len;
@ -695,15 +695,19 @@ bool CSendToCall::compareInputArgs(IEngExtCall* other, bool strict)
if (strict) { if (strict) {
if (otherCall->m_Len != m_Len) if (otherCall->m_Len != m_Len)
return false; return false;
} else { }
else {
int maxDiff; int maxDiff;
if (m_Len < 40) { if (m_Len < 40) {
maxDiff = 10; maxDiff = 10;
} else if (m_Len < 90) { }
else if (m_Len < 90) {
maxDiff = 15; maxDiff = 15;
} else if (m_Len < 120) { }
else if (m_Len < 120) {
maxDiff = 18; maxDiff = 18;
} else { }
else {
maxDiff = m_Len / 8; maxDiff = m_Len / 8;
} }
if (abs(otherCall->m_Len - m_Len) > maxDiff) if (abs(otherCall->m_Len - m_Len) > maxDiff)
@ -761,12 +765,12 @@ void CSendToCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CBindCall CBindCall
============================================================================ */ ============================================================================ */
CBindCall::CBindCall(SOCKET s, const void* addr, int addrlen) CBindCall::CBindCall(SOCKET s, const void* addr, int addrlen)
{ {
if (addrlen > sizeof(m_Addr)) if (addrlen > sizeof(m_Addr))
rehlds_syserror("%s: too large tolen (%d max %d)", __FUNCTION__, addrlen, sizeof(m_Addr)); rehlds_syserror("%s: too large tolen (%d max %d)", __func__, addrlen, sizeof(m_Addr));
m_Socket = s; m_Socket = s;
m_AddrLen = addrlen; m_AddrLen = addrlen;
@ -829,7 +833,7 @@ void CBindCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGetSockNameCall CGetSockNameCall
============================================================================ */ ============================================================================ */
CGetSockNameCall::CGetSockNameCall(SOCKET s, int addrlen) CGetSockNameCall::CGetSockNameCall(SOCKET s, int addrlen)
{ {
@ -850,7 +854,7 @@ std::string CGetSockNameCall::toString()
void CGetSockNameCall::setResult(const void* addr, int addrlen, int res) void CGetSockNameCall::setResult(const void* addr, int addrlen, int res)
{ {
if (addrlen > sizeof(m_Addr)) if (addrlen > sizeof(m_Addr))
rehlds_syserror("%s: too large tolen (%d max %d)", __FUNCTION__, addrlen, sizeof(m_Addr)); rehlds_syserror("%s: too large tolen (%d max %d)", __func__, addrlen, sizeof(m_Addr));
m_Res = res; m_Res = res;
m_AddrLenOut = addrlen; m_AddrLenOut = addrlen;
@ -898,7 +902,7 @@ void CGetSockNameCall::readEpilogue(std::istream &stream) {
.read((char*)&m_Res, 4); .read((char*)&m_Res, 4);
stream.read((char*)&m_Addr, m_AddrLenOut); stream.read((char*)&m_Addr, m_AddrLenOut);
} }
@ -907,7 +911,7 @@ void CGetSockNameCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CWSAGetLastErrorCall CWSAGetLastErrorCall
============================================================================ */ ============================================================================ */
std::string CWSAGetLastErrorCall::toString() std::string CWSAGetLastErrorCall::toString()
{ {
@ -937,12 +941,12 @@ void CWSAGetLastErrorCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CSteamCallbackCall1 CSteamCallbackCall1
============================================================================ */ ============================================================================ */
CSteamCallbackCall1::CSteamCallbackCall1(int cbId, void* data, int dataSize, CCallbackBase* cb) CSteamCallbackCall1::CSteamCallbackCall1(int cbId, void* data, int dataSize, CCallbackBase* cb)
{ {
if (dataSize > sizeof(m_Data)) if (dataSize > sizeof(m_Data))
rehlds_syserror("%s: too large data (%d, max %d)", __FUNCTION__, dataSize, sizeof(m_Data)); rehlds_syserror("%s: too large data (%d, max %d)", __func__, dataSize, sizeof(m_Data));
m_CallbackId = cbId; m_CallbackId = cbId;
m_DataSize = dataSize; m_DataSize = dataSize;
@ -1000,12 +1004,12 @@ void CSteamCallbackCall1::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CSteamCallbackCall2 CSteamCallbackCall2
============================================================================ */ ============================================================================ */
CSteamCallbackCall2::CSteamCallbackCall2(int cbId, void* data, int dataSize, bool ioFailure, SteamAPICall_t apiCall, CCallbackBase* cb) CSteamCallbackCall2::CSteamCallbackCall2(int cbId, void* data, int dataSize, bool ioFailure, SteamAPICall_t apiCall, CCallbackBase* cb)
{ {
if (dataSize > sizeof(m_Data)) if (dataSize > sizeof(m_Data))
rehlds_syserror("%s: too large data (%d, max %d)", __FUNCTION__, dataSize, sizeof(m_Data)); rehlds_syserror("%s: too large data (%d, max %d)", __func__, dataSize, sizeof(m_Data));
m_CallbackId = cbId; m_CallbackId = cbId;
m_DataSize = dataSize; m_DataSize = dataSize;
@ -1069,7 +1073,7 @@ void CSteamCallbackCall2::readEpilogue(std::istream &stream) {
} }
/* ============================================================================ /* ============================================================================
CSteamApiRegisterCallbackCall CSteamApiRegisterCallbackCall
============================================================================ */ ============================================================================ */
CSteamApiRegisterCallbackCall::CSteamApiRegisterCallbackCall(int rehldsCallbackId, int steamCallbackId, CCallbackBase* cb) CSteamApiRegisterCallbackCall::CSteamApiRegisterCallbackCall(int rehldsCallbackId, int steamCallbackId, CCallbackBase* cb)
{ {
@ -1131,7 +1135,7 @@ void CSteamApiRegisterCallbackCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CSteamApiInitCall CSteamApiInitCall
============================================================================ */ ============================================================================ */
std::string CSteamApiInitCall::toString() std::string CSteamApiInitCall::toString()
@ -1164,7 +1168,7 @@ void CSteamApiInitCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CSteamApiUnrigestierCallResultCall CSteamApiUnrigestierCallResultCall
============================================================================ */ ============================================================================ */
CSteamApiUnrigestierCallResultCall::CSteamApiUnrigestierCallResultCall(int rehldsCallbackId, SteamAPICall_t steamApiCall, CCallbackBase* cb) CSteamApiUnrigestierCallResultCall::CSteamApiUnrigestierCallResultCall(int rehldsCallbackId, SteamAPICall_t steamApiCall, CCallbackBase* cb)
{ {
@ -1225,7 +1229,7 @@ void CSteamApiUnrigestierCallResultCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CSteamAppsCall CSteamAppsCall
============================================================================ */ ============================================================================ */
std::string CSteamAppsCall::toString() std::string CSteamAppsCall::toString()
{ {
@ -1256,7 +1260,7 @@ void CSteamAppsCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CSteamAppGetCurrentGameLanguageCall CSteamAppGetCurrentGameLanguageCall
============================================================================ */ ============================================================================ */
std::string CSteamAppGetCurrentGameLanguageCall::toString() std::string CSteamAppGetCurrentGameLanguageCall::toString()
@ -1269,11 +1273,11 @@ std::string CSteamAppGetCurrentGameLanguageCall::toString()
void CSteamAppGetCurrentGameLanguageCall::setResult(const char* res) void CSteamAppGetCurrentGameLanguageCall::setResult(const char* res)
{ {
if (res == NULL) if (res == NULL)
rehlds_syserror("%s: null result", __FUNCTION__); rehlds_syserror("%s: null result", __func__);
m_ResLen = strlen(res) + 1; m_ResLen = strlen(res) + 1;
if (m_ResLen > sizeof(m_Res)) if (m_ResLen > sizeof(m_Res))
rehlds_syserror("%s: too large result", __FUNCTION__); rehlds_syserror("%s: too large result", __func__);
memcpy(m_Res, res, m_ResLen); memcpy(m_Res, res, m_ResLen);
} }
@ -1303,16 +1307,16 @@ void CSteamAppGetCurrentGameLanguageCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CSteamGameServerInitCall CSteamGameServerInitCall
============================================================================ */ ============================================================================ */
CSteamGameServerInitCall::CSteamGameServerInitCall(uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString) CSteamGameServerInitCall::CSteamGameServerInitCall(uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString)
{ {
if (pchVersionString == NULL) if (pchVersionString == NULL)
rehlds_syserror("%s: version is null", __FUNCTION__); rehlds_syserror("%s: version is null", __func__);
m_VersionLen = strlen(pchVersionString) + 1; m_VersionLen = strlen(pchVersionString) + 1;
if (m_VersionLen > sizeof(m_Version)) if (m_VersionLen > sizeof(m_Version))
rehlds_syserror("%s: too long version string", __FUNCTION__); rehlds_syserror("%s: too long version string", __func__);
memcpy(m_Version, pchVersionString, m_VersionLen); memcpy(m_Version, pchVersionString, m_VersionLen);
m_IP = unIP; m_IP = unIP;
@ -1398,7 +1402,7 @@ void CSteamGameServerInitCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CSteamGameServerCall CSteamGameServerCall
============================================================================ */ ============================================================================ */
std::string CSteamGameServerCall::toString() std::string CSteamGameServerCall::toString()
{ {
@ -1430,16 +1434,16 @@ void CSteamGameServerCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerSetProductCall CGameServerSetProductCall
============================================================================ */ ============================================================================ */
CGameServerSetProductCall::CGameServerSetProductCall(const char* product) CGameServerSetProductCall::CGameServerSetProductCall(const char* product)
{ {
if (product == NULL) if (product == NULL)
rehlds_syserror("%s: product is null", __FUNCTION__); rehlds_syserror("%s: product is null", __func__);
m_ProductLen = strlen(product) + 1; m_ProductLen = strlen(product) + 1;
if (m_ProductLen > sizeof(m_Product)) if (m_ProductLen > sizeof(m_Product))
rehlds_syserror("%s: too long product string", __FUNCTION__); rehlds_syserror("%s: too long product string", __func__);
memcpy(m_Product, product, m_ProductLen); memcpy(m_Product, product, m_ProductLen);
} }
@ -1482,16 +1486,16 @@ void CGameServerSetProductCall::readPrologue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerSetModDirCall CGameServerSetModDirCall
============================================================================ */ ============================================================================ */
CGameServerSetModDirCall::CGameServerSetModDirCall(const char* dir) CGameServerSetModDirCall::CGameServerSetModDirCall(const char* dir)
{ {
if (dir == NULL) if (dir == NULL)
rehlds_syserror("%s: dir is null", __FUNCTION__); rehlds_syserror("%s: dir is null", __func__);
m_DirLen = strlen(dir) + 1; m_DirLen = strlen(dir) + 1;
if (m_DirLen > sizeof(m_Dir)) if (m_DirLen > sizeof(m_Dir))
rehlds_syserror("%s: too long dir string", __FUNCTION__); rehlds_syserror("%s: too long dir string", __func__);
memcpy(m_Dir, dir, m_DirLen); memcpy(m_Dir, dir, m_DirLen);
} }
@ -1534,7 +1538,7 @@ void CGameServerSetModDirCall::readPrologue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerSetDedicatedServerCall CGameServerSetDedicatedServerCall
============================================================================ */ ============================================================================ */
CGameServerSetDedicatedServerCall::CGameServerSetDedicatedServerCall(bool dedicated) CGameServerSetDedicatedServerCall::CGameServerSetDedicatedServerCall(bool dedicated)
{ {
@ -1574,16 +1578,16 @@ void CGameServerSetDedicatedServerCall::readPrologue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerSetGameDescCall CGameServerSetGameDescCall
============================================================================ */ ============================================================================ */
CGameServerSetGameDescCall::CGameServerSetGameDescCall(const char* desc) CGameServerSetGameDescCall::CGameServerSetGameDescCall(const char* desc)
{ {
if (desc == NULL) if (desc == NULL)
rehlds_syserror("%s: desc is null", __FUNCTION__); rehlds_syserror("%s: desc is null", __func__);
m_DescLen = strlen(desc) + 1; m_DescLen = strlen(desc) + 1;
if (m_DescLen > sizeof(m_Desc)) if (m_DescLen > sizeof(m_Desc))
rehlds_syserror("%s: too long dir string", __FUNCTION__); rehlds_syserror("%s: too long dir string", __func__);
memcpy(m_Desc, desc, m_DescLen); memcpy(m_Desc, desc, m_DescLen);
} }
@ -1625,7 +1629,7 @@ void CGameServerSetGameDescCall::readPrologue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerLogOnAnonymousCall CGameServerLogOnAnonymousCall
============================================================================ */ ============================================================================ */
std::string CGameServerLogOnAnonymousCall::toString() std::string CGameServerLogOnAnonymousCall::toString()
{ {
@ -1648,7 +1652,7 @@ bool CGameServerLogOnAnonymousCall::compareInputArgs(IEngExtCall* other, bool st
/* ============================================================================ /* ============================================================================
CGameServerEnableHeartbeatsCall CGameServerEnableHeartbeatsCall
============================================================================ */ ============================================================================ */
CGameServerEnableHeartbeatsCall::CGameServerEnableHeartbeatsCall(bool hearbeats) CGameServerEnableHeartbeatsCall::CGameServerEnableHeartbeatsCall(bool hearbeats)
{ {
@ -1688,7 +1692,7 @@ void CGameServerEnableHeartbeatsCall::readPrologue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerSetHeartbeatIntervalCall CGameServerSetHeartbeatIntervalCall
============================================================================ */ ============================================================================ */
CGameServerSetHeartbeatIntervalCall::CGameServerSetHeartbeatIntervalCall(int interval) CGameServerSetHeartbeatIntervalCall::CGameServerSetHeartbeatIntervalCall(int interval)
{ {
@ -1726,7 +1730,7 @@ void CGameServerSetHeartbeatIntervalCall::readPrologue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerSetMaxPlayersCall CGameServerSetMaxPlayersCall
============================================================================ */ ============================================================================ */
CGameServerSetMaxPlayersCall::CGameServerSetMaxPlayersCall(int maxPlayers) CGameServerSetMaxPlayersCall::CGameServerSetMaxPlayersCall(int maxPlayers)
{ {
@ -1765,7 +1769,7 @@ void CGameServerSetMaxPlayersCall::readPrologue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerSetBotCountCall CGameServerSetBotCountCall
============================================================================ */ ============================================================================ */
CGameServerSetBotCountCall::CGameServerSetBotCountCall(int numBots) CGameServerSetBotCountCall::CGameServerSetBotCountCall(int numBots)
{ {
@ -1804,16 +1808,16 @@ void CGameServerSetBotCountCall::readPrologue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerSetServerNameCall CGameServerSetServerNameCall
============================================================================ */ ============================================================================ */
CGameServerSetServerNameCall::CGameServerSetServerNameCall(const char* serverName) CGameServerSetServerNameCall::CGameServerSetServerNameCall(const char* serverName)
{ {
if (serverName == NULL) if (serverName == NULL)
rehlds_syserror("%s: serverName is null", __FUNCTION__); rehlds_syserror("%s: serverName is null", __func__);
m_ServerNameLen = strlen(serverName) + 1; m_ServerNameLen = strlen(serverName) + 1;
if (m_ServerNameLen > sizeof(m_ServerName)) if (m_ServerNameLen > sizeof(m_ServerName))
rehlds_syserror("%s: too long serverName string", __FUNCTION__); rehlds_syserror("%s: too long serverName string", __func__);
memcpy(m_ServerName, serverName, m_ServerNameLen); memcpy(m_ServerName, serverName, m_ServerNameLen);
} }
@ -1856,16 +1860,16 @@ void CGameServerSetServerNameCall::readPrologue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerSetMapNameCall CGameServerSetMapNameCall
============================================================================ */ ============================================================================ */
CGameServerSetMapNameCall::CGameServerSetMapNameCall(const char* mapName) CGameServerSetMapNameCall::CGameServerSetMapNameCall(const char* mapName)
{ {
if (mapName == NULL) if (mapName == NULL)
rehlds_syserror("%s: serverName is null", __FUNCTION__); rehlds_syserror("%s: serverName is null", __func__);
m_MapNameLen = strlen(mapName) + 1; m_MapNameLen = strlen(mapName) + 1;
if (m_MapNameLen > sizeof(m_MapName)) if (m_MapNameLen > sizeof(m_MapName))
rehlds_syserror("%s: too long mapName string", __FUNCTION__); rehlds_syserror("%s: too long mapName string", __func__);
memcpy(m_MapName, mapName, m_MapNameLen); memcpy(m_MapName, mapName, m_MapNameLen);
} }
@ -1908,7 +1912,7 @@ void CGameServerSetMapNameCall::readPrologue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerSetPasswordProtectedCall CGameServerSetPasswordProtectedCall
============================================================================ */ ============================================================================ */
CGameServerSetPasswordProtectedCall::CGameServerSetPasswordProtectedCall(bool passwordProtected) CGameServerSetPasswordProtectedCall::CGameServerSetPasswordProtectedCall(bool passwordProtected)
{ {
@ -1948,7 +1952,7 @@ void CGameServerSetPasswordProtectedCall::readPrologue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerClearAllKVsCall CGameServerClearAllKVsCall
============================================================================ */ ============================================================================ */
std::string CGameServerClearAllKVsCall::toString() std::string CGameServerClearAllKVsCall::toString()
{ {
@ -1971,25 +1975,25 @@ bool CGameServerClearAllKVsCall::compareInputArgs(IEngExtCall* other, bool stric
/* ============================================================================ /* ============================================================================
CGameServerSetKeyValueCall CGameServerSetKeyValueCall
============================================================================ */ ============================================================================ */
CGameServerSetKeyValueCall::CGameServerSetKeyValueCall(const char* key, const char* value) CGameServerSetKeyValueCall::CGameServerSetKeyValueCall(const char* key, const char* value)
{ {
if (key == NULL) if (key == NULL)
rehlds_syserror("%s: key is null", __FUNCTION__); rehlds_syserror("%s: key is null", __func__);
m_KeyLen = strlen(key) + 1; m_KeyLen = strlen(key) + 1;
if (m_KeyLen > sizeof(m_Key)) if (m_KeyLen > sizeof(m_Key))
rehlds_syserror("%s: too long key string", __FUNCTION__); rehlds_syserror("%s: too long key string", __func__);
memcpy(m_Key, key, m_KeyLen); memcpy(m_Key, key, m_KeyLen);
if (value == NULL) if (value == NULL)
rehlds_syserror("%s: value is null", __FUNCTION__); rehlds_syserror("%s: value is null", __func__);
m_ValueLen = strlen(value) + 1; m_ValueLen = strlen(value) + 1;
if (m_ValueLen > sizeof(m_Value)) if (m_ValueLen > sizeof(m_Value))
rehlds_syserror("%s: too long value string", __FUNCTION__); rehlds_syserror("%s: too long value string", __func__);
memcpy(m_Value, value, m_ValueLen); memcpy(m_Value, value, m_ValueLen);
} }
@ -2034,7 +2038,7 @@ void CGameServerSetKeyValueCall::readPrologue(std::istream &stream) {
stream stream
.read((char*)&m_ValueLen, sizeof(m_ValueLen)) .read((char*)&m_ValueLen, sizeof(m_ValueLen))
.read((char*)&m_KeyLen, sizeof(m_KeyLen)); .read((char*)&m_KeyLen, sizeof(m_KeyLen));
stream stream
.read(m_Value, m_ValueLen) .read(m_Value, m_ValueLen)
.read(m_Key, m_KeyLen); .read(m_Key, m_KeyLen);
@ -2044,7 +2048,7 @@ void CGameServerSetKeyValueCall::readPrologue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CSteamApiSetBreakpadAppIdCall CSteamApiSetBreakpadAppIdCall
============================================================================ */ ============================================================================ */
CSteamApiSetBreakpadAppIdCall::CSteamApiSetBreakpadAppIdCall(uint32 appId) CSteamApiSetBreakpadAppIdCall::CSteamApiSetBreakpadAppIdCall(uint32 appId)
{ {
@ -2084,7 +2088,7 @@ void CSteamApiSetBreakpadAppIdCall::readPrologue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerWasRestartRequestedCall CGameServerWasRestartRequestedCall
============================================================================ */ ============================================================================ */
std::string CGameServerWasRestartRequestedCall::toString() std::string CGameServerWasRestartRequestedCall::toString()
{ {
@ -2116,7 +2120,7 @@ void CGameServerWasRestartRequestedCall::readPrologue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CSteamGameServerRunCallbacksCall CSteamGameServerRunCallbacksCall
============================================================================ */ ============================================================================ */
std::string CSteamGameServerRunCallbacksCall::toString() std::string CSteamGameServerRunCallbacksCall::toString()
{ {
@ -2139,7 +2143,7 @@ bool CSteamGameServerRunCallbacksCall::compareInputArgs(IEngExtCall* other, bool
/* ============================================================================ /* ============================================================================
CGameServerGetNextOutgoingPacketCall CGameServerGetNextOutgoingPacketCall
============================================================================ */ ============================================================================ */
CGameServerGetNextOutgoingPacketCall::CGameServerGetNextOutgoingPacketCall(int maxOut) CGameServerGetNextOutgoingPacketCall::CGameServerGetNextOutgoingPacketCall(int maxOut)
{ {
@ -2152,17 +2156,17 @@ void CGameServerGetNextOutgoingPacketCall::setResult(void* buf, int res, uint32*
m_BufLen = res > 0 ? res : 0; m_BufLen = res > 0 ? res : 0;
if (m_BufLen > 0) { if (m_BufLen > 0) {
if (m_BufLen > sizeof(m_Buf)) if (m_BufLen > sizeof(m_Buf))
rehlds_syserror("%s: too long buffer returned", __FUNCTION__); rehlds_syserror("%s: too long buffer returned", __func__);
memcpy(m_Buf, buf, m_BufLen); memcpy(m_Buf, buf, m_BufLen);
} }
m_Result = res; m_Result = res;
if (pAddr == NULL) if (pAddr == NULL)
rehlds_syserror("%s: pAddr is NULL", __FUNCTION__); rehlds_syserror("%s: pAddr is NULL", __func__);
if (pPort == NULL) if (pPort == NULL)
rehlds_syserror("%s: pPort is NULL", __FUNCTION__); rehlds_syserror("%s: pPort is NULL", __func__);
m_Addr = *pAddr; m_Addr = *pAddr;
m_Port = *pPort; m_Port = *pPort;
@ -2221,7 +2225,7 @@ void CGameServerGetNextOutgoingPacketCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CSteamApiRunCallbacksCall CSteamApiRunCallbacksCall
============================================================================ */ ============================================================================ */
std::string CSteamApiRunCallbacksCall::toString() std::string CSteamApiRunCallbacksCall::toString()
{ {
@ -2244,7 +2248,7 @@ bool CSteamApiRunCallbacksCall::compareInputArgs(IEngExtCall* other, bool strict
/* ============================================================================ /* ============================================================================
CGameServerGetSteamIdCall CGameServerGetSteamIdCall
============================================================================ */ ============================================================================ */
std::string CGameServerGetSteamIdCall::toString() std::string CGameServerGetSteamIdCall::toString()
{ {
@ -2275,7 +2279,7 @@ void CGameServerGetSteamIdCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerBSecureCall CGameServerBSecureCall
============================================================================ */ ============================================================================ */
std::string CGameServerBSecureCall::toString() std::string CGameServerBSecureCall::toString()
{ {
@ -2307,14 +2311,14 @@ void CGameServerBSecureCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerHandleIncomingPacketCall CGameServerHandleIncomingPacketCall
============================================================================ */ ============================================================================ */
CGameServerHandleIncomingPacketCall::CGameServerHandleIncomingPacketCall(const void *pData, int cbData, uint32 srcIP, uint16 srcPort) CGameServerHandleIncomingPacketCall::CGameServerHandleIncomingPacketCall(const void *pData, int cbData, uint32 srcIP, uint16 srcPort)
{ {
m_Len = cbData; m_Len = cbData;
if (m_Len > sizeof(m_Data)) if (m_Len > sizeof(m_Data))
rehlds_syserror("%s: too long packet", __FUNCTION__); rehlds_syserror("%s: too long packet", __func__);
memcpy(m_Data, pData, m_Len); memcpy(m_Data, pData, m_Len);
m_Ip = srcIP; m_Ip = srcIP;
@ -2380,13 +2384,13 @@ void CGameServerHandleIncomingPacketCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerSendUserConnectAndAuthenticateCall CGameServerSendUserConnectAndAuthenticateCall
============================================================================ */ ============================================================================ */
CGameServerSendUserConnectAndAuthenticateCall::CGameServerSendUserConnectAndAuthenticateCall(uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize) CGameServerSendUserConnectAndAuthenticateCall::CGameServerSendUserConnectAndAuthenticateCall(uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize)
{ {
m_AuthBlobLen = cubAuthBlobSize; m_AuthBlobLen = cubAuthBlobSize;
if (m_AuthBlobLen > sizeof(m_AuthBlob)) if (m_AuthBlobLen > sizeof(m_AuthBlob))
rehlds_syserror("%s: too long auth blob", __FUNCTION__); rehlds_syserror("%s: too long auth blob", __func__);
memcpy(m_AuthBlob, pvAuthBlob, m_AuthBlobLen); memcpy(m_AuthBlob, pvAuthBlob, m_AuthBlobLen);
m_IP = unIPClient; m_IP = unIPClient;
@ -2456,7 +2460,7 @@ void CGameServerSendUserConnectAndAuthenticateCall::readEpilogue(std::istream &s
/* ============================================================================ /* ============================================================================
CGameServerSendUserDisconnectCall CGameServerSendUserDisconnectCall
============================================================================ */ ============================================================================ */
std::string CGameServerSendUserDisconnectCall::toString() std::string CGameServerSendUserDisconnectCall::toString()
{ {
@ -2490,13 +2494,13 @@ void CGameServerSendUserDisconnectCall::readPrologue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerBUpdateUserDataCall CGameServerBUpdateUserDataCall
============================================================================ */ ============================================================================ */
CGameServerBUpdateUserDataCall::CGameServerBUpdateUserDataCall(CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore) CGameServerBUpdateUserDataCall::CGameServerBUpdateUserDataCall(CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore)
{ {
m_PlayerNameLen = strlen(pchPlayerName) + 1; m_PlayerNameLen = strlen(pchPlayerName) + 1;
if (m_PlayerNameLen > sizeof(m_PlayerName)) if (m_PlayerNameLen > sizeof(m_PlayerName))
rehlds_syserror("%s: too long player name", __FUNCTION__); rehlds_syserror("%s: too long player name", __func__);
memcpy(m_PlayerName, pchPlayerName, m_PlayerNameLen); memcpy(m_PlayerName, pchPlayerName, m_PlayerNameLen);
m_SteamId = steamIDUser.ConvertToUint64(); m_SteamId = steamIDUser.ConvertToUint64();
@ -2563,7 +2567,7 @@ void CGameServerBUpdateUserDataCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerCreateUnauthUserConnectionCall CGameServerCreateUnauthUserConnectionCall
============================================================================ */ ============================================================================ */
std::string CGameServerCreateUnauthUserConnectionCall::toString() std::string CGameServerCreateUnauthUserConnectionCall::toString()
{ {
@ -2596,7 +2600,7 @@ void CGameServerCreateUnauthUserConnectionCall::readEpilogue(std::istream &strea
/* ============================================================================ /* ============================================================================
CGetHostNameCall CGetHostNameCall
============================================================================ */ ============================================================================ */
std::string CGetHostNameCall::toString() std::string CGetHostNameCall::toString()
{ {
@ -2622,7 +2626,7 @@ void CGetHostNameCall::setResult(char* hostName, int res) {
m_NameLenOut = strlen(hostName) + 1; m_NameLenOut = strlen(hostName) + 1;
if (m_NameLenOut > sizeof(m_Name)) if (m_NameLenOut > sizeof(m_Name))
rehlds_syserror("%s: too long host name", __FUNCTION__); rehlds_syserror("%s: too long host name", __func__);
strcpy(m_Name, hostName); strcpy(m_Name, hostName);
m_Res = res; m_Res = res;
@ -2655,13 +2659,13 @@ void CGetHostNameCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGetHostByNameCall CGetHostByNameCall
============================================================================ */ ============================================================================ */
CGetHostByNameCall::CGetHostByNameCall(const char* name) CGetHostByNameCall::CGetHostByNameCall(const char* name)
{ {
m_NameLen = strlen(name) + 1; m_NameLen = strlen(name) + 1;
if (m_NameLen > sizeof(m_Name)) if (m_NameLen > sizeof(m_Name))
rehlds_syserror("%s: too long name", __FUNCTION__); rehlds_syserror("%s: too long name", __func__);
strcpy(m_Name, name); strcpy(m_Name, name);
} }
@ -2692,19 +2696,19 @@ bool CGetHostByNameCall::compareInputArgs(IEngExtCall* other, bool strict)
void CGetHostByNameCall::setResult(const hostent* hostEnt) { void CGetHostByNameCall::setResult(const hostent* hostEnt) {
m_HostentData.hostNameLen = strlen(hostEnt->h_name) + 1; m_HostentData.hostNameLen = strlen(hostEnt->h_name) + 1;
if (m_HostentData.hostNameLen > sizeof(m_HostentData.hostName)) { if (m_HostentData.hostNameLen > sizeof(m_HostentData.hostName)) {
rehlds_syserror("%s: too long host name", __FUNCTION__); rehlds_syserror("%s: too long host name", __func__);
} }
strcpy(m_HostentData.hostName, hostEnt->h_name); strcpy(m_HostentData.hostName, hostEnt->h_name);
int i = 0; int i = 0;
while (hostEnt->h_aliases[i]) { while (hostEnt->h_aliases[i]) {
if (i >= HOSTENT_DATA_MAX_ALIASES) { if (i >= HOSTENT_DATA_MAX_ALIASES) {
rehlds_syserror("%s: too many aliases", __FUNCTION__); rehlds_syserror("%s: too many aliases", __func__);
} }
m_HostentData.aliasesLengths[i] = strlen(hostEnt->h_aliases[i]) + 1; m_HostentData.aliasesLengths[i] = strlen(hostEnt->h_aliases[i]) + 1;
if (m_HostentData.aliasesLengths[i] > sizeof(m_HostentData.aliases[i])) { if (m_HostentData.aliasesLengths[i] > sizeof(m_HostentData.aliases[i])) {
rehlds_syserror("%s: too long alias", __FUNCTION__); rehlds_syserror("%s: too long alias", __func__);
} }
strcpy(m_HostentData.aliases[i], hostEnt->h_aliases[i]); strcpy(m_HostentData.aliases[i], hostEnt->h_aliases[i]);
@ -2715,13 +2719,13 @@ void CGetHostByNameCall::setResult(const hostent* hostEnt) {
m_HostentData.addrtype = hostEnt->h_addrtype; m_HostentData.addrtype = hostEnt->h_addrtype;
m_HostentData.addrLen = hostEnt->h_length; m_HostentData.addrLen = hostEnt->h_length;
if (m_HostentData.addrLen > sizeof(m_HostentData.addrs[0])) { if (m_HostentData.addrLen > sizeof(m_HostentData.addrs[0])) {
rehlds_syserror("%s: too long addr", __FUNCTION__); rehlds_syserror("%s: too long addr", __func__);
} }
i = 0; i = 0;
while (hostEnt->h_addr_list[i]) { while (hostEnt->h_addr_list[i]) {
if (i >= HOSTENT_DATA_MAX_ADDRS) { if (i >= HOSTENT_DATA_MAX_ADDRS) {
rehlds_syserror("%s: too many addrs", __FUNCTION__); rehlds_syserror("%s: too many addrs", __func__);
} }
memcpy(m_HostentData.addrs[i], hostEnt->h_addr_list[i], m_HostentData.addrLen); memcpy(m_HostentData.addrs[i], hostEnt->h_addr_list[i], m_HostentData.addrLen);
@ -2784,12 +2788,12 @@ void CGetHostByNameCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGetProcessTimesCall CGetProcessTimesCall
============================================================================ */ ============================================================================ */
std::string CGetProcessTimesCall::toString() std::string CGetProcessTimesCall::toString()
{ {
std::stringstream ss; std::stringstream ss;
ss << "GetProcessTimes( creationTime: "; PrintFileTime(&m_CreationTime, ss); ss << "GetProcessTimes( creationTime: "; PrintFileTime(&m_CreationTime, ss);
ss << "; exitTime: "; PrintFileTime(&m_ExitTime, ss); ss << "; exitTime: "; PrintFileTime(&m_ExitTime, ss);
ss << "; kernelTime: "; PrintFileTime(&m_KernelTime, ss); ss << "; kernelTime: "; PrintFileTime(&m_KernelTime, ss);
@ -2839,7 +2843,7 @@ void CGetProcessTimesCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGetSystemTimeAsFileTimeCall CGetSystemTimeAsFileTimeCall
============================================================================ */ ============================================================================ */
std::string CGetSystemTimeAsFileTimeCall::toString() std::string CGetSystemTimeAsFileTimeCall::toString()
{ {
@ -2877,7 +2881,7 @@ void CGetSystemTimeAsFileTimeCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CStdTimeCall CStdTimeCall
============================================================================ */ ============================================================================ */
CStdTimeCall::CStdTimeCall(uint32* inTime) CStdTimeCall::CStdTimeCall(uint32* inTime)
{ {
@ -2931,7 +2935,7 @@ void CStdTimeCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CStdLocalTimeCall CStdLocalTimeCall
============================================================================ */ ============================================================================ */
CStdLocalTimeCall::CStdLocalTimeCall(uint32 inTime) CStdLocalTimeCall::CStdLocalTimeCall(uint32 inTime)
{ {
@ -2985,7 +2989,7 @@ void CStdLocalTimeCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CStdSrandCall CStdSrandCall
============================================================================ */ ============================================================================ */
std::string CStdSrandCall::toString() std::string CStdSrandCall::toString()
{ {
@ -3020,7 +3024,7 @@ void CStdSrandCall::readPrologue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CStdRandCall CStdRandCall
============================================================================ */ ============================================================================ */
std::string CStdRandCall::toString() std::string CStdRandCall::toString()
{ {
@ -3052,7 +3056,7 @@ void CStdRandCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerLogOffCall CGameServerLogOffCall
============================================================================ */ ============================================================================ */
std::string CGameServerLogOffCall::toString() std::string CGameServerLogOffCall::toString()
{ {
@ -3075,7 +3079,7 @@ bool CGameServerLogOffCall::compareInputArgs(IEngExtCall* other, bool strict)
/* ============================================================================ /* ============================================================================
CSteamGameServerShutdownCall CSteamGameServerShutdownCall
============================================================================ */ ============================================================================ */
std::string CSteamGameServerShutdownCall::toString() std::string CSteamGameServerShutdownCall::toString()
{ {
@ -3099,7 +3103,7 @@ bool CSteamGameServerShutdownCall::compareInputArgs(IEngExtCall* other, bool str
/* ============================================================================ /* ============================================================================
CSteamApiUnregisterCallbackCall CSteamApiUnregisterCallbackCall
============================================================================ */ ============================================================================ */
CSteamApiUnregisterCallbackCall::CSteamApiUnregisterCallbackCall(int rehldsCallbackId, CCallbackBase* cb) CSteamApiUnregisterCallbackCall::CSteamApiUnregisterCallbackCall(int rehldsCallbackId, CCallbackBase* cb)
{ {
@ -3155,7 +3159,7 @@ void CSteamApiUnregisterCallbackCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CGameServerBLoggedOnCall CGameServerBLoggedOnCall
============================================================================ */ ============================================================================ */
std::string CGameServerBLoggedOnCall::toString() std::string CGameServerBLoggedOnCall::toString()
{ {
@ -3201,7 +3205,7 @@ virtual void readEpilogue(std::istream &stream);
*/ */
#define IEngExtCallFactory_CreateFuncCall(clazz, buf, bufLen) \ #define IEngExtCallFactory_CreateFuncCall(clazz, buf, bufLen) \
if (sizeof(clazz) > bufLen) rehlds_syserror("%s: buffer to small", __FUNCTION__); \ if (sizeof(clazz) > bufLen) rehlds_syserror("%s: buffer to small", __func__); \
return new(buf) clazz(); return new(buf) clazz();
IEngExtCall* IEngExtCallFactory::createByOpcode(ExtCallFuncs opc, void* buf, int ptrSize) { IEngExtCall* IEngExtCallFactory::createByOpcode(ExtCallFuncs opc, void* buf, int ptrSize) {
@ -3220,7 +3224,7 @@ IEngExtCall* IEngExtCallFactory::createByOpcode(ExtCallFuncs opc, void* buf, int
case ECF_CLOSE_SOCKET: IEngExtCallFactory_CreateFuncCall(CCloseSocketCall, buf, ptrSize); case ECF_CLOSE_SOCKET: IEngExtCallFactory_CreateFuncCall(CCloseSocketCall, buf, ptrSize);
case ECF_RECVFROM: IEngExtCallFactory_CreateFuncCall(CRecvFromCall, buf, ptrSize); case ECF_RECVFROM: IEngExtCallFactory_CreateFuncCall(CRecvFromCall, buf, ptrSize);
case ECF_SENDTO: IEngExtCallFactory_CreateFuncCall(CSendToCall, buf, ptrSize); case ECF_SENDTO: IEngExtCallFactory_CreateFuncCall(CSendToCall, buf, ptrSize);
case ECF_BIND: IEngExtCallFactory_CreateFuncCall(CBindCall , buf, ptrSize); case ECF_BIND: IEngExtCallFactory_CreateFuncCall(CBindCall, buf, ptrSize);
case ECF_GET_SOCK_NAME: IEngExtCallFactory_CreateFuncCall(CGetSockNameCall, buf, ptrSize); case ECF_GET_SOCK_NAME: IEngExtCallFactory_CreateFuncCall(CGetSockNameCall, buf, ptrSize);
case ECF_WSA_GET_LAST_ERROR: IEngExtCallFactory_CreateFuncCall(CWSAGetLastErrorCall, buf, ptrSize); case ECF_WSA_GET_LAST_ERROR: IEngExtCallFactory_CreateFuncCall(CWSAGetLastErrorCall, buf, ptrSize);
@ -3263,7 +3267,7 @@ IEngExtCall* IEngExtCallFactory::createByOpcode(ExtCallFuncs opc, void* buf, int
case ECF_GS_CREATE_UNAUTH_USER_CONNECTION: IEngExtCallFactory_CreateFuncCall(CGameServerCreateUnauthUserConnectionCall, buf, ptrSize); case ECF_GS_CREATE_UNAUTH_USER_CONNECTION: IEngExtCallFactory_CreateFuncCall(CGameServerCreateUnauthUserConnectionCall, buf, ptrSize);
case ECF_GET_HOST_BY_NAME: IEngExtCallFactory_CreateFuncCall(CGetHostByNameCall, buf, ptrSize); case ECF_GET_HOST_BY_NAME: IEngExtCallFactory_CreateFuncCall(CGetHostByNameCall, buf, ptrSize);
case ECF_GET_HOST_NAME: IEngExtCallFactory_CreateFuncCall(CGetHostNameCall, buf, ptrSize); case ECF_GET_HOST_NAME: IEngExtCallFactory_CreateFuncCall(CGetHostNameCall, buf, ptrSize);
case ECF_GET_PROCESS_TIMES: IEngExtCallFactory_CreateFuncCall(CGetProcessTimesCall, buf, ptrSize); case ECF_GET_PROCESS_TIMES: IEngExtCallFactory_CreateFuncCall(CGetProcessTimesCall, buf, ptrSize);
case ECF_GET_SYSTEM_TIME_AS_FILE_TIME: IEngExtCallFactory_CreateFuncCall(CGetSystemTimeAsFileTimeCall, buf, ptrSize); case ECF_GET_SYSTEM_TIME_AS_FILE_TIME: IEngExtCallFactory_CreateFuncCall(CGetSystemTimeAsFileTimeCall, buf, ptrSize);
@ -3279,10 +3283,10 @@ IEngExtCall* IEngExtCallFactory::createByOpcode(ExtCallFuncs opc, void* buf, int
case ECF_STEAM_API_UNREGISTER_CALLBACK: IEngExtCallFactory_CreateFuncCall(CSteamApiUnregisterCallbackCall, buf, ptrSize); case ECF_STEAM_API_UNREGISTER_CALLBACK: IEngExtCallFactory_CreateFuncCall(CSteamApiUnregisterCallbackCall, buf, ptrSize);
case ECF_GS_BLOGGEDON: IEngExtCallFactory_CreateFuncCall(CGameServerBLoggedOnCall, buf, ptrSize); case ECF_GS_BLOGGEDON: IEngExtCallFactory_CreateFuncCall(CGameServerBLoggedOnCall, buf, ptrSize);
default: default:
rehlds_syserror("%s: unknown funccall opcode %d", __FUNCTION__, opc); rehlds_syserror("%s: unknown funccall opcode %d", __func__, opc);
return NULL; return NULL;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -19,8 +19,8 @@ CSteamCallbackRecordingWrapper::CSteamCallbackRecordingWrapper(CRecordingEngExtI
void CSteamCallbackRecordingWrapper::Run(void *pvParam) void CSteamCallbackRecordingWrapper::Run(void *pvParam)
{ {
if (m_Wrapped->GetICallback() != this->GetICallback()) rehlds_syserror("%s: iCallback desync", __FUNCTION__); if (m_Wrapped->GetICallback() != this->GetICallback()) rehlds_syserror("%s: iCallback desync", __func__);
if (m_Wrapped->GetFlags() != this->GetFlags()) rehlds_syserror("%s: flags desync", __FUNCTION__); if (m_Wrapped->GetFlags() != this->GetFlags()) rehlds_syserror("%s: flags desync", __func__);
CSteamCallbackCall1 fcall(m_Id, pvParam, m_Size, m_Wrapped); CRecorderFuncCall frec(&fcall); CSteamCallbackCall1 fcall(m_Id, pvParam, m_Size, m_Wrapped); CRecorderFuncCall frec(&fcall);
m_Recorder->PushFunc(&frec); m_Recorder->PushFunc(&frec);
@ -33,8 +33,8 @@ void CSteamCallbackRecordingWrapper::Run(void *pvParam)
void CSteamCallbackRecordingWrapper::Run(void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall) void CSteamCallbackRecordingWrapper::Run(void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall)
{ {
if (m_Wrapped->GetICallback() != this->GetICallback()) rehlds_syserror("%s: iCallback desync", __FUNCTION__); if (m_Wrapped->GetICallback() != this->GetICallback()) rehlds_syserror("%s: iCallback desync", __func__);
if (m_Wrapped->GetFlags() != this->GetFlags()) rehlds_syserror("%s: flags desync", __FUNCTION__); if (m_Wrapped->GetFlags() != this->GetFlags()) rehlds_syserror("%s: flags desync", __func__);
CSteamCallbackCall2 fcall(m_Id, pvParam, m_Size, bIOFailure, hSteamAPICall, m_Wrapped); CRecorderFuncCall frec(&fcall); CSteamCallbackCall2 fcall(m_Id, pvParam, m_Size, bIOFailure, hSteamAPICall, m_Wrapped); CRecorderFuncCall frec(&fcall);
m_Recorder->PushFunc(&frec); m_Recorder->PushFunc(&frec);
@ -61,25 +61,25 @@ CSteamAppsRecordingWrapper::CSteamAppsRecordingWrapper(ISteamApps* original, CRe
bool CSteamAppsRecordingWrapper::BIsSubscribed() bool CSteamAppsRecordingWrapper::BIsSubscribed()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
bool CSteamAppsRecordingWrapper::BIsLowViolence() bool CSteamAppsRecordingWrapper::BIsLowViolence()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
bool CSteamAppsRecordingWrapper::BIsCybercafe() bool CSteamAppsRecordingWrapper::BIsCybercafe()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
bool CSteamAppsRecordingWrapper::BIsVACBanned() bool CSteamAppsRecordingWrapper::BIsVACBanned()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
@ -95,82 +95,82 @@ const char* CSteamAppsRecordingWrapper::GetCurrentGameLanguage()
const char* CSteamAppsRecordingWrapper::GetAvailableGameLanguages() const char* CSteamAppsRecordingWrapper::GetAvailableGameLanguages()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return NULL; return NULL;
} }
bool CSteamAppsRecordingWrapper::BIsSubscribedApp(AppId_t appID) bool CSteamAppsRecordingWrapper::BIsSubscribedApp(AppId_t appID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
bool CSteamAppsRecordingWrapper::BIsDlcInstalled(AppId_t appID) bool CSteamAppsRecordingWrapper::BIsDlcInstalled(AppId_t appID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
uint32 CSteamAppsRecordingWrapper::GetEarliestPurchaseUnixTime(AppId_t nAppID) uint32 CSteamAppsRecordingWrapper::GetEarliestPurchaseUnixTime(AppId_t nAppID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return 0; return 0;
} }
bool CSteamAppsRecordingWrapper::BIsSubscribedFromFreeWeekend() bool CSteamAppsRecordingWrapper::BIsSubscribedFromFreeWeekend()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
int CSteamAppsRecordingWrapper::GetDLCCount() int CSteamAppsRecordingWrapper::GetDLCCount()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return 0; return 0;
} }
bool CSteamAppsRecordingWrapper::BGetDLCDataByIndex(int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize) bool CSteamAppsRecordingWrapper::BGetDLCDataByIndex(int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
void CSteamAppsRecordingWrapper::InstallDLC(AppId_t nAppID) void CSteamAppsRecordingWrapper::InstallDLC(AppId_t nAppID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void CSteamAppsRecordingWrapper::UninstallDLC(AppId_t nAppID) void CSteamAppsRecordingWrapper::UninstallDLC(AppId_t nAppID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void CSteamAppsRecordingWrapper::RequestAppProofOfPurchaseKey(AppId_t nAppID) void CSteamAppsRecordingWrapper::RequestAppProofOfPurchaseKey(AppId_t nAppID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
bool CSteamAppsRecordingWrapper::GetCurrentBetaName(char *pchName, int cchNameBufferSize) bool CSteamAppsRecordingWrapper::GetCurrentBetaName(char *pchName, int cchNameBufferSize)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
bool CSteamAppsRecordingWrapper::MarkContentCorrupt(bool bMissingFilesOnly) bool CSteamAppsRecordingWrapper::MarkContentCorrupt(bool bMissingFilesOnly)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
uint32 CSteamAppsRecordingWrapper::GetInstalledDepots(DepotId_t *pvecDepots, uint32 cMaxDepots) uint32 CSteamAppsRecordingWrapper::GetInstalledDepots(DepotId_t *pvecDepots, uint32 cMaxDepots)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return 0; return 0;
} }
uint32 CSteamAppsRecordingWrapper::GetAppInstallDir(AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize) uint32 CSteamAppsRecordingWrapper::GetAppInstallDir(AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return 0; return 0;
} }
@ -183,7 +183,7 @@ CSteamGameServerRecordingWrapper::CSteamGameServerRecordingWrapper(ISteamGameSer
bool CSteamGameServerRecordingWrapper::InitGameServer(uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString) bool CSteamGameServerRecordingWrapper::InitGameServer(uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
@ -221,7 +221,7 @@ void CSteamGameServerRecordingWrapper::SetDedicatedServer(bool bDedicated)
void CSteamGameServerRecordingWrapper::LogOn(const char *pszAccountName, const char *pszPassword) void CSteamGameServerRecordingWrapper::LogOn(const char *pszAccountName, const char *pszPassword)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void CSteamGameServerRecordingWrapper::LogOnAnonymous() void CSteamGameServerRecordingWrapper::LogOnAnonymous()
@ -322,12 +322,12 @@ void CSteamGameServerRecordingWrapper::SetPasswordProtected(bool bPasswordProtec
void CSteamGameServerRecordingWrapper::SetSpectatorPort(uint16 unSpectatorPort) void CSteamGameServerRecordingWrapper::SetSpectatorPort(uint16 unSpectatorPort)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void CSteamGameServerRecordingWrapper::SetSpectatorServerName(const char *pszSpectatorServerName) void CSteamGameServerRecordingWrapper::SetSpectatorServerName(const char *pszSpectatorServerName)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void CSteamGameServerRecordingWrapper::ClearAllKeyValues() void CSteamGameServerRecordingWrapper::ClearAllKeyValues()
@ -348,17 +348,17 @@ void CSteamGameServerRecordingWrapper::SetKeyValue(const char *pKey, const char
void CSteamGameServerRecordingWrapper::SetGameTags(const char *pchGameTags) void CSteamGameServerRecordingWrapper::SetGameTags(const char *pchGameTags)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void CSteamGameServerRecordingWrapper::SetGameData(const char *pchGameData) void CSteamGameServerRecordingWrapper::SetGameData(const char *pchGameData)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void CSteamGameServerRecordingWrapper::SetRegion(const char *pszRegion) void CSteamGameServerRecordingWrapper::SetRegion(const char *pszRegion)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
bool CSteamGameServerRecordingWrapper::SendUserConnectAndAuthenticate(uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser) bool CSteamGameServerRecordingWrapper::SendUserConnectAndAuthenticate(uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser)
@ -401,52 +401,52 @@ bool CSteamGameServerRecordingWrapper::BUpdateUserData(CSteamID steamIDUser, con
HAuthTicket CSteamGameServerRecordingWrapper::GetAuthSessionTicket(void *pTicket, int cbMaxTicket, uint32 *pcbTicket) HAuthTicket CSteamGameServerRecordingWrapper::GetAuthSessionTicket(void *pTicket, int cbMaxTicket, uint32 *pcbTicket)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return k_HAuthTicketInvalid; return k_HAuthTicketInvalid;
} }
EBeginAuthSessionResult CSteamGameServerRecordingWrapper::BeginAuthSession(const void *pAuthTicket, int cbAuthTicket, CSteamID steamID) EBeginAuthSessionResult CSteamGameServerRecordingWrapper::BeginAuthSession(const void *pAuthTicket, int cbAuthTicket, CSteamID steamID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return k_EBeginAuthSessionResultInvalidTicket; return k_EBeginAuthSessionResultInvalidTicket;
} }
void CSteamGameServerRecordingWrapper::EndAuthSession(CSteamID steamID) void CSteamGameServerRecordingWrapper::EndAuthSession(CSteamID steamID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void CSteamGameServerRecordingWrapper::CancelAuthTicket(HAuthTicket hAuthTicket) void CSteamGameServerRecordingWrapper::CancelAuthTicket(HAuthTicket hAuthTicket)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
EUserHasLicenseForAppResult CSteamGameServerRecordingWrapper::UserHasLicenseForApp(CSteamID steamID, AppId_t appID) EUserHasLicenseForAppResult CSteamGameServerRecordingWrapper::UserHasLicenseForApp(CSteamID steamID, AppId_t appID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return k_EUserHasLicenseResultDoesNotHaveLicense; return k_EUserHasLicenseResultDoesNotHaveLicense;
} }
bool CSteamGameServerRecordingWrapper::RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup) bool CSteamGameServerRecordingWrapper::RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return false; return false;
} }
void CSteamGameServerRecordingWrapper::GetGameplayStats() void CSteamGameServerRecordingWrapper::GetGameplayStats()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
SteamAPICall_t CSteamGameServerRecordingWrapper::GetServerReputation() SteamAPICall_t CSteamGameServerRecordingWrapper::GetServerReputation()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return k_uAPICallInvalid; return k_uAPICallInvalid;
} }
uint32 CSteamGameServerRecordingWrapper::GetPublicIP() uint32 CSteamGameServerRecordingWrapper::GetPublicIP()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return 0; return 0;
} }
@ -488,18 +488,18 @@ void CSteamGameServerRecordingWrapper::SetHeartbeatInterval(int iHeartbeatInterv
void CSteamGameServerRecordingWrapper::ForceHeartbeat() void CSteamGameServerRecordingWrapper::ForceHeartbeat()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
SteamAPICall_t CSteamGameServerRecordingWrapper::AssociateWithClan(CSteamID steamIDClan) SteamAPICall_t CSteamGameServerRecordingWrapper::AssociateWithClan(CSteamID steamIDClan)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return k_uAPICallInvalid; return k_uAPICallInvalid;
} }
SteamAPICall_t CSteamGameServerRecordingWrapper::ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer) SteamAPICall_t CSteamGameServerRecordingWrapper::ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return k_uAPICallInvalid; return k_uAPICallInvalid;
} }
@ -574,7 +574,7 @@ void CRecordingEngExtInterceptor::PushFunc(CRecorderFuncCall* func)
void CRecordingEngExtInterceptor::PopFunc(CRecorderFuncCall* func) void CRecordingEngExtInterceptor::PopFunc(CRecorderFuncCall* func)
{ {
if (func != m_LastFunc) if (func != m_LastFunc)
rehlds_syserror("%s: stack corrupted", __FUNCTION__); rehlds_syserror("%s: stack corrupted", __func__);
writeCall(!func->m_StartWritten, true, func->m_FuncCall); writeCall(!func->m_StartWritten, true, func->m_FuncCall);
if (m_LastFunc->m_Prev == NULL) { if (m_LastFunc->m_Prev == NULL) {
@ -842,8 +842,8 @@ void CRecordingEngExtInterceptor::SteamAPI_RegisterCallback(CCallbackBase *pCall
{ {
CSteamCallbackRecordingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback); CSteamCallbackRecordingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback);
if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __FUNCTION__); if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __func__);
//if (wrappee->GetICallback() != pCallback->GetICallback()) rehlds_syserror("%s: flags desync", __FUNCTION__); //if (wrappee->GetICallback() != pCallback->GetICallback()) rehlds_syserror("%s: flags desync", __func__);
CSteamApiRegisterCallbackCall fcall(wrappee->getRehldsCallbackId(), iCallback, wrappee); CRecorderFuncCall frec(&fcall); CSteamApiRegisterCallbackCall fcall(wrappee->getRehldsCallbackId(), iCallback, wrappee); CRecorderFuncCall frec(&fcall);
PushFunc(&frec); PushFunc(&frec);
@ -870,8 +870,8 @@ void CRecordingEngExtInterceptor::SteamAPI_UnregisterCallResult(class CCallbackB
{ {
CSteamCallbackRecordingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback); CSteamCallbackRecordingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback);
if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __FUNCTION__); if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __func__);
if (wrappee->GetICallback() != pCallback->GetICallback()) rehlds_syserror("%s: flags desync", __FUNCTION__); if (wrappee->GetICallback() != pCallback->GetICallback()) rehlds_syserror("%s: flags desync", __func__);
CSteamApiUnrigestierCallResultCall fcall(wrappee->getRehldsCallbackId(), hAPICall, wrappee); CRecorderFuncCall frec(&fcall); CSteamApiUnrigestierCallResultCall fcall(wrappee->getRehldsCallbackId(), hAPICall, wrappee); CRecorderFuncCall frec(&fcall);
@ -981,8 +981,8 @@ void CRecordingEngExtInterceptor::SteamAPI_UnregisterCallback(CCallbackBase *pCa
{ {
CSteamCallbackRecordingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback); CSteamCallbackRecordingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback);
if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __FUNCTION__); if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __func__);
if (wrappee->GetICallback() != pCallback->GetICallback()) rehlds_syserror("%s: flags desync", __FUNCTION__); if (wrappee->GetICallback() != pCallback->GetICallback()) rehlds_syserror("%s: flags desync", __func__);
CSteamApiUnregisterCallbackCall fcall(wrappee->getRehldsCallbackId(), wrappee); CRecorderFuncCall frec(&fcall); CSteamApiUnregisterCallbackCall fcall(wrappee->getRehldsCallbackId(), wrappee); CRecorderFuncCall frec(&fcall);
PushFunc(&frec); PushFunc(&frec);

View File

@ -12,7 +12,7 @@ uint32 __cdecl time_hooked(uint32* pTime)
struct tm* __cdecl localtime_hooked(uint32* pTime) struct tm* __cdecl localtime_hooked(uint32* pTime)
{ {
if (pTime == NULL) if (pTime == NULL)
rehlds_syserror("%s: pTime is NULL", __FUNCTION__); rehlds_syserror("%s: pTime is NULL", __func__);
return CRehldsPlatformHolder::get()->localtime(*pTime); return CRehldsPlatformHolder::get()->localtime(*pTime);
} }
@ -119,12 +119,12 @@ int __stdcall gethostname_hooked(char *name, int namelen)
void __cdecl SteamAPI_SetMiniDumpComment_hooked(const char *pchMsg) void __cdecl SteamAPI_SetMiniDumpComment_hooked(const char *pchMsg)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void __cdecl SteamAPI_WriteMiniDump_hooked(uint32 uStructuredExceptionCode, void* pvExceptionInfo, uint32 uBuildID) void __cdecl SteamAPI_WriteMiniDump_hooked(uint32 uStructuredExceptionCode, void* pvExceptionInfo, uint32 uBuildID)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void __cdecl SteamAPI_RegisterCallback_hooked(class CCallbackBase *pCallback, int iCallback) void __cdecl SteamAPI_RegisterCallback_hooked(class CCallbackBase *pCallback, int iCallback)
@ -144,13 +144,13 @@ bool __cdecl SteamAPI_Init_hooked()
ISteamUser* __cdecl SteamUser_hooked() ISteamUser* __cdecl SteamUser_hooked()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return NULL; return NULL;
} }
ISteamFriends* __cdecl SteamFriends_hooked() ISteamFriends* __cdecl SteamFriends_hooked()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return NULL; return NULL;
} }
@ -161,7 +161,7 @@ void __cdecl SteamGameServer_RunCallbacks_hooked()
void __cdecl SteamAPI_Shutdown_hooked() void __cdecl SteamAPI_Shutdown_hooked()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
void __cdecl SteamGameServer_Shutdown_hooked() void __cdecl SteamGameServer_Shutdown_hooked()
@ -191,12 +191,12 @@ void __cdecl SteamAPI_SetBreakpadAppID_hooked(uint32 unAppID)
void __cdecl SteamAPI_RegisterCallResult_hooked(class CCallbackBase *pCallback, SteamAPICall_t hAPICall) void __cdecl SteamAPI_RegisterCallResult_hooked(class CCallbackBase *pCallback, SteamAPICall_t hAPICall)
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
} }
ISteamHTTP* __cdecl SteamHTTP_hooked() ISteamHTTP* __cdecl SteamHTTP_hooked()
{ {
rehlds_syserror("%s: not implemented", __FUNCTION__); rehlds_syserror("%s: not implemented", __func__);
return NULL; return NULL;
} }

View File

@ -8,26 +8,29 @@ import org.gradle.nativeplatform.toolchain.VisualCpp
apply from: 'shared_msvc.gradle' apply from: 'shared_msvc.gradle'
apply from: 'shared_icc.gradle' apply from: 'shared_icc.gradle'
apply from: 'shared_gcc.gradle'
rootProject.ext.createToolchainConfig = { NativeBinarySpec bin -> rootProject.ext.createToolchainConfig = { NativeBinarySpec bin ->
BinaryKind binaryKind BinaryKind binaryKind
if (bin instanceof NativeExecutableBinarySpec) { if (bin instanceof NativeExecutableBinarySpec) {
binaryKind = BinaryKind.EXECUTABLE binaryKind = BinaryKind.EXECUTABLE
} else if (bin instanceof SharedLibraryBinarySpec) { } else if (bin instanceof SharedLibraryBinarySpec) {
binaryKind = BinaryKind.SHARED_LIBRARY binaryKind = BinaryKind.SHARED_LIBRARY
} else if (bin instanceof StaticLibraryBinarySpec) { } else if (bin instanceof StaticLibraryBinarySpec) {
binaryKind = BinaryKind.STATIC_LIBRARY binaryKind = BinaryKind.STATIC_LIBRARY
} else { } else {
throw new RuntimeException("Unknown executable kind ${bin.class.name}") throw new RuntimeException("Unknown executable kind ${bin.class.name}")
} }
boolean releaseBuild = bin.buildType.name.toLowerCase() == 'release' boolean releaseBuild = bin.buildType.name.toLowerCase() == 'release'
if (bin.toolChain instanceof VisualCpp) { if (bin.toolChain instanceof VisualCpp) {
return rootProject.createMsvcConfig(releaseBuild, binaryKind) return rootProject.createMsvcConfig(releaseBuild, binaryKind)
} else if (bin.toolChain instanceof Icc) { } else if (bin.toolChain instanceof Icc) {
return rootProject.createIccConfig(releaseBuild, binaryKind) return rootProject.createIccConfig(releaseBuild, binaryKind)
} else { } else if (bin.toolChain instanceof Gcc) {
throw new RuntimeException("Unknown native toolchain: ${bin.toolChain.class.name}") return rootProject.createGccConfig(releaseBuild, binaryKind)
} } else {
throw new RuntimeException("Unknown native toolchain: ${bin.toolChain.class.name}")
}
} }

62
shared_gcc.gradle Normal file
View File

@ -0,0 +1,62 @@
import org.doomedsociety.gradlecpp.cfg.BinaryKind
import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig
import org.doomedsociety.gradlecpp.gcc.OptimizationLevel
rootProject.ext.createGccConfig = { boolean release, BinaryKind binKind ->
GccToolchainConfig cfg
if (release) {
cfg = new GccToolchainConfig(
compilerOptions: new GccToolchainConfig.CompilerOptions(
optimizationLevel: OptimizationLevel.LEVEL_3,
stackProtector: false,
//interProceduralOptimizations: true,
noBuiltIn: true,
//intelExtensions: false,
//asmBlocks: true,
positionIndependentCode: false
),
linkerOptions: new GccToolchainConfig.LinkerOptions(
//interProceduralOptimizations: true,
stripSymbolTable: true,
staticLibGcc: true,
//staticIntel: true,
staticLibStdCpp: true,
),
librarianOptions: new GccToolchainConfig.LibrarianOptions(
)
)
} else {
//debug
cfg = new GccToolchainConfig(
compilerOptions: new GccToolchainConfig.CompilerOptions(
optimizationLevel: OptimizationLevel.DISABLE,
stackProtector: true,
//interProceduralOptimizations: false,
noBuiltIn: true,
//intelExtensions: false,
//asmBlocks: true
),
linkerOptions: new GccToolchainConfig.LinkerOptions(
//interProceduralOptimizations: false,
stripSymbolTable: false,
staticLibGcc: true,
//staticIntel: true,
staticLibStdCpp: true,
),
librarianOptions: new GccToolchainConfig.LibrarianOptions(
)
)
}
return cfg
}

View File

@ -3,60 +3,60 @@ import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig
import org.doomedsociety.gradlecpp.gcc.OptimizationLevel import org.doomedsociety.gradlecpp.gcc.OptimizationLevel
rootProject.ext.createIccConfig = { boolean release, BinaryKind binKind -> rootProject.ext.createIccConfig = { boolean release, BinaryKind binKind ->
GccToolchainConfig cfg GccToolchainConfig cfg
if (release) { if (release) {
cfg = new GccToolchainConfig( cfg = new GccToolchainConfig(
compilerOptions: new GccToolchainConfig.CompilerOptions( compilerOptions: new GccToolchainConfig.CompilerOptions(
optimizationLevel: OptimizationLevel.LEVEL_3, optimizationLevel: OptimizationLevel.LEVEL_3,
stackProtector: false, stackProtector: false,
interProceduralOptimizations: true, interProceduralOptimizations: true,
noBuiltIn: true, noBuiltIn: true,
intelExtensions: false, intelExtensions: false,
asmBlocks: true, asmBlocks: true,
positionIndependentCode: false positionIndependentCode: false
), ),
linkerOptions: new GccToolchainConfig.LinkerOptions( linkerOptions: new GccToolchainConfig.LinkerOptions(
interProceduralOptimizations: true, interProceduralOptimizations: true,
stripSymbolTable: true, stripSymbolTable: true,
staticLibGcc: true, staticLibGcc: true,
staticIntel: true, staticIntel: true,
staticLibStdCpp: true, staticLibStdCpp: true,
), ),
librarianOptions: new GccToolchainConfig.LibrarianOptions( librarianOptions: new GccToolchainConfig.LibrarianOptions(
) )
) )
} else { } else {
//debug //debug
cfg = new GccToolchainConfig( cfg = new GccToolchainConfig(
compilerOptions: new GccToolchainConfig.CompilerOptions( compilerOptions: new GccToolchainConfig.CompilerOptions(
optimizationLevel: OptimizationLevel.DISABLE, optimizationLevel: OptimizationLevel.DISABLE,
stackProtector: true, stackProtector: true,
interProceduralOptimizations: false, interProceduralOptimizations: false,
noBuiltIn: true, noBuiltIn: true,
intelExtensions: false, intelExtensions: false,
asmBlocks: true asmBlocks: true
), ),
linkerOptions: new GccToolchainConfig.LinkerOptions( linkerOptions: new GccToolchainConfig.LinkerOptions(
interProceduralOptimizations: false, interProceduralOptimizations: false,
stripSymbolTable: false, stripSymbolTable: false,
staticLibGcc: true, staticLibGcc: true,
staticIntel: true, staticIntel: true,
staticLibStdCpp: true, staticLibStdCpp: true,
), ),
librarianOptions: new GccToolchainConfig.LibrarianOptions( librarianOptions: new GccToolchainConfig.LibrarianOptions(
) )
) )
} }
return cfg return cfg
} }

View File

@ -13,111 +13,111 @@ import org.doomedsociety.gradlecpp.msvc.RuntimeChecks
import org.doomedsociety.gradlecpp.msvc.WarningLevel import org.doomedsociety.gradlecpp.msvc.WarningLevel
rootProject.ext.createMsvcConfig = { boolean release, BinaryKind binKind -> rootProject.ext.createMsvcConfig = { boolean release, BinaryKind binKind ->
MsvcToolchainConfig cfg MsvcToolchainConfig cfg
if (release) { if (release) {
cfg = new MsvcToolchainConfig( cfg = new MsvcToolchainConfig(
compilerOptions: new MsvcToolchainConfig.CompilerOptions( compilerOptions: new MsvcToolchainConfig.CompilerOptions(
codeGeneration: CodeGenerationKind.MULTITHREADED, codeGeneration: CodeGenerationKind.MULTITHREADED,
optimizationLevel: OptimizationLevel.FULL_OPTIMIZATION, optimizationLevel: OptimizationLevel.FULL_OPTIMIZATION,
debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE,
runtimeChecks: RuntimeChecks.DEFAULT, runtimeChecks: RuntimeChecks.DEFAULT,
cppExceptions: CppExceptions.ENABLED_WITH_SEH, cppExceptions: CppExceptions.ENABLED_WITH_SEH,
warningLevel: WarningLevel.LEVEL_3, warningLevel: WarningLevel.LEVEL_3,
callingConvention: CallingConvention.CDECL, callingConvention: CallingConvention.CDECL,
enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, enhancedInstructionsSet: EnhancedInstructionsSet.SSE2,
floatingPointModel: FloatingPointModel.FAST, floatingPointModel: FloatingPointModel.FAST,
enableMinimalRebuild: false, enableMinimalRebuild: false,
omitFramePointers: false, omitFramePointers: false,
wholeProgramOptimization: true, wholeProgramOptimization: true,
enabledFunctionLevelLinking: true, enabledFunctionLevelLinking: true,
enableSecurityCheck: true, enableSecurityCheck: true,
analyzeCode: false, analyzeCode: false,
sdlChecks: false, sdlChecks: false,
treatWarningsAsErrors: false, treatWarningsAsErrors: false,
treatWchartAsBuiltin: true, treatWchartAsBuiltin: true,
forceConformanceInForLoopScope: true, forceConformanceInForLoopScope: true,
extraDefines: [ extraDefines: [
'WIN32': null, 'WIN32': null,
'_MBCS': null, '_MBCS': null,
'NDEBUG': null, 'NDEBUG': null,
] ]
), ),
linkerOptions: new MsvcToolchainConfig.LinkerOptions( linkerOptions: new MsvcToolchainConfig.LinkerOptions(
linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG, linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG,
errorReportingMode: ErrorReporting.NO_ERROR_REPORT, errorReportingMode: ErrorReporting.NO_ERROR_REPORT,
enableIncrementalLinking: false, enableIncrementalLinking: false,
eliminateUnusedRefs: true, eliminateUnusedRefs: true,
enableCOMDATFolding: true, enableCOMDATFolding: true,
generateDebugInfo: true, generateDebugInfo: true,
dataExecutionPrevention: true, dataExecutionPrevention: true,
randomizedBaseAddress: true randomizedBaseAddress: true
), ),
librarianOptions: new MsvcToolchainConfig.LibrarianOptions( librarianOptions: new MsvcToolchainConfig.LibrarianOptions(
linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG
), ),
generatePdb: true generatePdb: true
) )
} else { } else {
//debug //debug
cfg = new MsvcToolchainConfig( cfg = new MsvcToolchainConfig(
compilerOptions: new MsvcToolchainConfig.CompilerOptions( compilerOptions: new MsvcToolchainConfig.CompilerOptions(
codeGeneration: CodeGenerationKind.MULTITHREADED_DEBUG, codeGeneration: CodeGenerationKind.MULTITHREADED_DEBUG,
optimizationLevel: OptimizationLevel.DISABLED, optimizationLevel: OptimizationLevel.DISABLED,
debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE,
runtimeChecks: RuntimeChecks.DEFAULT, runtimeChecks: RuntimeChecks.DEFAULT,
cppExceptions: CppExceptions.ENABLED_WITH_SEH, cppExceptions: CppExceptions.ENABLED_WITH_SEH,
warningLevel: WarningLevel.LEVEL_3, warningLevel: WarningLevel.LEVEL_3,
callingConvention: CallingConvention.CDECL, callingConvention: CallingConvention.CDECL,
enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, enhancedInstructionsSet: EnhancedInstructionsSet.SSE2,
floatingPointModel: FloatingPointModel.FAST, floatingPointModel: FloatingPointModel.FAST,
enableMinimalRebuild: true, enableMinimalRebuild: true,
omitFramePointers: false, omitFramePointers: false,
wholeProgramOptimization: false, wholeProgramOptimization: false,
enabledFunctionLevelLinking: true, enabledFunctionLevelLinking: true,
enableSecurityCheck: true, enableSecurityCheck: true,
analyzeCode: false, analyzeCode: false,
sdlChecks: false, sdlChecks: false,
treatWarningsAsErrors: false, treatWarningsAsErrors: false,
treatWchartAsBuiltin: true, treatWchartAsBuiltin: true,
forceConformanceInForLoopScope: true, forceConformanceInForLoopScope: true,
extraDefines: [ extraDefines: [
'WIN32': null, 'WIN32': null,
'_MBCS': null, '_MBCS': null,
'_DEBUG': null, '_DEBUG': null,
] ]
), ),
linkerOptions: new MsvcToolchainConfig.LinkerOptions( linkerOptions: new MsvcToolchainConfig.LinkerOptions(
linkTimeCodeGenKind: LinkTimeCodeGenKind.DEFAULT, linkTimeCodeGenKind: LinkTimeCodeGenKind.DEFAULT,
errorReportingMode: ErrorReporting.NO_ERROR_REPORT, errorReportingMode: ErrorReporting.NO_ERROR_REPORT,
enableIncrementalLinking: true, enableIncrementalLinking: true,
eliminateUnusedRefs: false, eliminateUnusedRefs: false,
enableCOMDATFolding: false, enableCOMDATFolding: false,
generateDebugInfo: true, generateDebugInfo: true,
dataExecutionPrevention: true, dataExecutionPrevention: true,
randomizedBaseAddress: true randomizedBaseAddress: true
), ),
librarianOptions: new MsvcToolchainConfig.LibrarianOptions( librarianOptions: new MsvcToolchainConfig.LibrarianOptions(
linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG
), ),
generatePdb: true generatePdb: true
) )
if (binKind == BinaryKind.STATIC_LIBRARY) { if (binKind == BinaryKind.STATIC_LIBRARY) {
cfg.compilerConfig.extraDefines['_LIB'] = null cfg.compilerConfig.extraDefines['_LIB'] = null
} }
} }
return cfg return cfg
} }