From 2f64cfc873b25ca16f96db43727fe7d681b92cd3 Mon Sep 17 00:00:00 2001 From: Lev Date: Sat, 11 Feb 2017 01:51:22 +0500 Subject: [PATCH] GCC support (#339) * GCC support - could be used via -PuseGcc command line argument. * Refactoring around __FUNCTION__, change __FUNCTION__ into __func__. * Refactoring, formatting, small fixes. --- .gitignore | 3 + README.md | 14 +- build.gradle | 56 +-- dep/bzip2/build.gradle | 106 ++--- dep/cppunitlite/build.gradle | 46 +- flightrec/decoder/build.gradle | 28 +- flightrec/decoder_api/build.gradle | 100 ++--- publish.gradle | 238 +++++----- rehlds/build.gradle | 525 ++++++++++++----------- rehlds/common/mathlib.h | 27 +- rehlds/engine/cl_null.cpp | 2 +- rehlds/engine/client.h | 2 +- rehlds/engine/cmd.cpp | 48 ++- rehlds/engine/cmd.h | 20 +- rehlds/engine/cmodel.cpp | 2 +- rehlds/engine/common.cpp | 40 +- rehlds/engine/common.h | 2 +- rehlds/engine/crc.cpp | 2 +- rehlds/engine/cvar.cpp | 4 +- rehlds/engine/decals.cpp | 55 +-- rehlds/engine/delta.cpp | 46 +- rehlds/engine/delta_jit.cpp | 22 +- rehlds/engine/ed_strpool.cpp | 2 +- rehlds/engine/hashpak.cpp | 10 +- rehlds/engine/host.cpp | 14 +- rehlds/engine/host_cmd.cpp | 8 +- rehlds/engine/mathlib.cpp | 4 +- rehlds/engine/model.cpp | 89 ++-- rehlds/engine/net_chan.cpp | 10 +- rehlds/engine/net_ws.cpp | 31 +- rehlds/engine/pmovetst.cpp | 2 +- rehlds/engine/pr_cmds.cpp | 150 ++++--- rehlds/engine/pr_edict.cpp | 24 +- rehlds/engine/r_studio.cpp | 4 +- rehlds/engine/sv_main.cpp | 129 +++--- rehlds/engine/sv_move.h | 4 +- rehlds/engine/sv_phys.cpp | 6 +- rehlds/engine/sv_steam3.cpp | 4 +- rehlds/engine/sv_upld.cpp | 4 +- rehlds/engine/sv_user.cpp | 2 +- rehlds/engine/sys_dll.cpp | 22 +- rehlds/engine/sys_dll.h | 17 +- rehlds/engine/sys_dll2.cpp | 8 +- rehlds/engine/sys_engine.cpp | 2 +- rehlds/engine/textures.cpp | 8 +- rehlds/engine/tmessage.cpp | 2 +- rehlds/engine/wad.cpp | 10 +- rehlds/engine/world.cpp | 12 +- rehlds/engine/zone.cpp | 52 +-- rehlds/hookers/hooker.cpp | 12 +- rehlds/hookers/memory.cpp | 6 +- rehlds/msvc/ReHLDS.vcxproj | 1 - rehlds/msvc/ReHLDS.vcxproj.filters | 3 - rehlds/public/rehlds/cmd_rehlds.h | 2 +- rehlds/public/rehlds/eiface.h | 2 +- rehlds/public/rehlds/osconfig.h | 28 +- rehlds/public/rehlds/rehlds_api.h | 2 +- rehlds/public/rehlds/static_map.h | 2 +- rehlds/public/tier0/fasttimer.h | 424 ------------------ rehlds/public/tier0/platform.h | 4 +- rehlds/rehlds/FlightRecorderImpl.cpp | 20 +- rehlds/rehlds/FlightRecorderImpl.h | 2 +- rehlds/rehlds/RehldsRuntimeConfig.cpp | 8 +- rehlds/rehlds/hookchains_impl.cpp | 6 +- rehlds/rehlds/hookchains_impl.h | 2 +- rehlds/rehlds/platform.cpp | 2 +- rehlds/rehlds/rehlds_interfaces_impl.cpp | 6 +- rehlds/testsuite/anonymizer.cpp | 132 +++--- rehlds/testsuite/funccalls.cpp | 240 ++++++----- rehlds/testsuite/player.cpp | 436 +++++++++---------- rehlds/testsuite/recorder.cpp | 96 ++--- rehlds/testsuite/testsuite.cpp | 16 +- shared.gradle | 39 +- shared_gcc.gradle | 62 +++ shared_icc.gradle | 90 ++-- shared_msvc.gradle | 188 ++++---- 76 files changed, 1766 insertions(+), 2083 deletions(-) delete mode 100644 rehlds/public/tier0/fasttimer.h create mode 100644 shared_gcc.gradle diff --git a/.gitignore b/.gitignore index 2c5a089..30fa6ef 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,10 @@ **/msvc/*.opensdf **/msvc/*.user **/msvc/*.suo +**/msvc/*.db +**/msvc/*.opendb **/msvc/ipch +**/msvc/.vs rehlds/version/appversion.h rehlds/msvc/PublishPath*.txt diff --git a/README.md b/README.md index 3bde861..e2fd534 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ There are several software requirements for building rehlds:
  1. Java Development Kit (JDK) 7+ (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
  2. For Windows: Visual Studio 2013 and later
  3. -
  4. For Linux: Intel C++ Compiler 13 and later
  5. +
  6. For Linux: Intel C++ Compiler 13 and later or GCC 4.9.2 or later (some earlier versions might work too)
### Checking requirements @@ -80,17 +80,27 @@ Help -> About icc (ICC) 15.0.1 20141023 +####GCC +
$ gcc --version
+gcc (Debian 4.9.2-10) 4.9.2
+
+ ### Building On Windows:
gradlew --max-workers=1 clean buildRelease
* For faster building without unit tests use this:exclamation:
gradlew --max-workers=1 clean buildFixes
-On Linux: +On Linux (ICC):
./gradlew --max-workers=1 clean buildRelease
* For faster building without unit tests use this:exclamation:
./gradlew --max-workers=1 clean buildFixes
+On Linux (GCC): +
./gradlew --max-workers=1 -PuseGcc clean buildRelease
+* For faster building without unit tests use this:exclamation: +
./gradlew --max-workers=1 -PuseGcc clean buildFixes
+ Compiled binaries will be placed in the rehlds/build/binaries/ directory ## How can I help the project? diff --git a/build.gradle b/build.gradle index de12d30..4ac20c5 100644 --- a/build.gradle +++ b/build.gradle @@ -9,40 +9,40 @@ group = 'rehlds' apply plugin: 'idea' idea { - project { - languageLevel = 'JDK_1_7' - } + project { + languageLevel = 'JDK_1_7' + } } def gitInfo = GitVersioner.versionForDir(project.rootDir) RehldsVersionInfo versionInfo if (gitInfo && gitInfo.tag && gitInfo.tag[0] == 'v') { - def m = gitInfo.tag =~ /^v(\d+)\.(\d+)(\.(\d+))?$/ - if (!m.find()) { - throw new RuntimeException("Invalid git version tag name ${gitInfo.tag}") - } + def m = gitInfo.tag =~ /^v(\d+)\.(\d+)(\.(\d+))?$/ + if (!m.find()) { + throw new RuntimeException("Invalid git version tag name ${gitInfo.tag}") + } - versionInfo = new RehldsVersionInfo( - majorVersion: m.group(1) as int, - minorVersion: m.group(2) as int, - maintenanceVersion: m.group(4) ? (m.group(4) as int) : null, - localChanges: gitInfo.localChanges, - commitDate: gitInfo.commitDate, - commitSHA: gitInfo.commitSHA, - commitURL: gitInfo.commitURL - ) + versionInfo = new RehldsVersionInfo( + majorVersion: m.group(1) as int, + minorVersion: m.group(2) as int, + maintenanceVersion: m.group(4) ? (m.group(4) as int) : null, + localChanges: gitInfo.localChanges, + commitDate: gitInfo.commitDate, + commitSHA: gitInfo.commitSHA, + commitURL: gitInfo.commitURL + ) } else { - versionInfo = new RehldsVersionInfo( - majorVersion: project.majorVersion as int, - minorVersion: project.minorVersion as int, - maintenanceVersion: project.maintenanceVersion as int, - suffix: 'dev', - localChanges: gitInfo ? gitInfo.localChanges : true, - commitDate: gitInfo ? gitInfo.commitDate : new DateTime(), - commitSHA: gitInfo ? gitInfo.commitSHA : "", - commitURL: gitInfo ? gitInfo.commitURL : "", - commitCount: gitInfo ? (gitInfo.commitCount as int) : null - ) + versionInfo = new RehldsVersionInfo( + majorVersion: project.majorVersion as int, + minorVersion: project.minorVersion as int, + maintenanceVersion: project.maintenanceVersion as int, + suffix: 'dev', + localChanges: gitInfo ? gitInfo.localChanges : true, + commitDate: gitInfo ? gitInfo.commitDate : new DateTime(), + commitSHA: gitInfo ? gitInfo.commitSHA : "", + commitURL: gitInfo ? gitInfo.commitURL : "", + commitCount: gitInfo ? (gitInfo.commitCount as int) : null + ) } project.ext.rehldsVersionInfo = versionInfo @@ -51,5 +51,5 @@ project.version = versionInfo.asMavenVersion() apply from: 'publish.gradle' task wrapper(type: Wrapper) { - gradleVersion = '2.4' + gradleVersion = '2.4' } diff --git a/dep/bzip2/build.gradle b/dep/bzip2/build.gradle index 649ea6d..09fef5a 100644 --- a/dep/bzip2/build.gradle +++ b/dep/bzip2/build.gradle @@ -2,6 +2,7 @@ import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig import org.doomedsociety.gradlecpp.toolchain.icc.Icc import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin +import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig import org.gradle.nativeplatform.NativeBinarySpec import org.gradle.nativeplatform.NativeLibrarySpec import org.gradle.nativeplatform.toolchain.VisualCpp @@ -9,67 +10,70 @@ import org.gradle.nativeplatform.toolchain.VisualCpp apply plugin: 'c' apply plugin: IccCompilerPlugin +apply plugin: GccCompilerPlugin void setupToolchain(NativeBinarySpec b) { - def cfg = rootProject.createToolchainConfig(b) - if (cfg instanceof MsvcToolchainConfig) { - cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( - enabled: true, - pchHeader: 'bzlib_private.h', - pchSourceSet: 'bz2_pch' - ) - } + def cfg = rootProject.createToolchainConfig(b) + if (cfg instanceof MsvcToolchainConfig) { + cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( + enabled: true, + pchHeader: 'bzlib_private.h', + pchSourceSet: 'bz2_pch' + ) + } - ToolchainConfigUtils.apply(project, cfg, b) + ToolchainConfigUtils.apply(project, cfg, b) } model { - buildTypes { - debug - release - } + buildTypes { + debug + release + } - platforms { - x86 { - architecture "x86" - } - } + platforms { + x86 { + architecture "x86" + } + } - toolChains { - visualCpp(VisualCpp) { - } - icc(Icc) { - } - } + toolChains { + visualCpp(VisualCpp) + if (project.hasProperty("useGcc")) { + gcc(Gcc) + } else { + icc(Icc) + } + } - components { - bzip2(NativeLibrarySpec) { - targetPlatform 'x86' + components { + bzip2(NativeLibrarySpec) { + targetPlatform 'x86' - sources { - bz2_main(CSourceSet) { - source { - srcDir "src" - include "**/*.c" - exclude "precompiled.c" - } - exportedHeaders { - srcDir "include" - } - } + sources { + bz2_main(CSourceSet) { + source { + srcDir "src" + include "**/*.c" + exclude "precompiled.c" + } + exportedHeaders { + srcDir "include" + } + } - bz2_pch(CSourceSet) { - source { - srcDir "src" - include "precompiled.c" - } - exportedHeaders { - srcDir "include" - } - } - } + bz2_pch(CSourceSet) { + source { + srcDir "src" + include "precompiled.c" + } + exportedHeaders { + srcDir "include" + } + } + } - binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } - } - } + binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } + } + } } diff --git a/dep/cppunitlite/build.gradle b/dep/cppunitlite/build.gradle index 6fc4523..bae46b8 100644 --- a/dep/cppunitlite/build.gradle +++ b/dep/cppunitlite/build.gradle @@ -2,38 +2,42 @@ import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig import org.doomedsociety.gradlecpp.toolchain.icc.Icc import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin +import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig import org.gradle.nativeplatform.NativeBinarySpec import org.gradle.nativeplatform.NativeLibrarySpec apply plugin: 'cpp' apply plugin: IccCompilerPlugin +apply plugin: GccCompilerPlugin 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 { - buildTypes { - debug - release - } + buildTypes { + debug + release + } - platforms { - x86 { - architecture "x86" - } - } + platforms { + x86 { + architecture "x86" + } + } - toolChains { - visualCpp(VisualCpp) { - } - icc(Icc) { - } - } + toolChains { + visualCpp(VisualCpp) + if (project.hasProperty("useGcc")) { + gcc(Gcc) + } else { + icc(Icc) + } + } - components { + components { cppunitlite(NativeLibrarySpec) { targetPlatform 'x86' @@ -51,9 +55,9 @@ model { } - binaries.all { NativeBinarySpec b -> - project.setupToolchain(b) - } + binaries.all { NativeBinarySpec b -> + project.setupToolchain(b) + } } } } diff --git a/flightrec/decoder/build.gradle b/flightrec/decoder/build.gradle index d658f5d..707f713 100644 --- a/flightrec/decoder/build.gradle +++ b/flightrec/decoder/build.gradle @@ -8,28 +8,28 @@ sourceCompatibility = '1.7' targetCompatibility = '1.7' repositories { - mavenCentral() + mavenCentral() } dependencies { - testCompile 'org.codehaus.groovy:groovy-all:2.4.5' - testCompile "junit:junit:4.12" - compile project(':flightrec/decoder_api') + testCompile 'org.codehaus.groovy:groovy-all:2.4.5' + testCompile "junit:junit:4.12" + compile project(':flightrec/decoder_api') } task uberjar(type: Jar, dependsOn: ['check', ':flightrec/decoder_api:build']) { - from files(sourceSets.main.output.classesDir) - 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 + from files(sourceSets.main.output.classesDir) + 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 - manifest { - attributes 'Main-Class': 'org.rehlds.flightrec.main.FlightRecorder' - attributes 'Implementation-Vendor': 'Sun Microsystems, Inc' - attributes 'Implementation-Title': 'Java Runtime Environment' - attributes 'Implementation-Version': '1.7.0' - } + manifest { + attributes 'Main-Class': 'org.rehlds.flightrec.main.FlightRecorder' + attributes 'Implementation-Vendor': 'Sun Microsystems, Inc' + attributes 'Implementation-Title': 'Java Runtime Environment' + attributes 'Implementation-Version': '1.7.0' + } } tasks.withType(AbstractCompile) { - options.encoding = 'UTF-8' + options.encoding = 'UTF-8' } diff --git a/flightrec/decoder_api/build.gradle b/flightrec/decoder_api/build.gradle index deff67b..3ec5e22 100644 --- a/flightrec/decoder_api/build.gradle +++ b/flightrec/decoder_api/build.gradle @@ -8,67 +8,67 @@ sourceCompatibility = '1.7' targetCompatibility = '1.7' repositories { - mavenCentral() + mavenCentral() } dependencies { - testCompile "junit:junit:4.12" + testCompile "junit:junit:4.12" } publishing { - publications { - maven(MavenPublication) { - version project.version - artifactId 'decoder-api' - artifact jar + publications { + maven(MavenPublication) { + version project.version + artifactId 'decoder-api' + artifact jar - pom.withXml { - asNode().children().last() + { - resolveStrategy = DELEGATE_FIRST - name 'decoder-api' - description project.description - //url github - //scm { - // url "${github}.git" - // connection "scm:git:${github}.git" - //} - /* - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution 'repo' - } - } - developers { - developer { - id 'dreamstalker' - name 'dreamstalker' - } - } - */ - } - } - } - } + pom.withXml { + asNode().children().last() + { + resolveStrategy = DELEGATE_FIRST + name 'decoder-api' + description project.description + //url github + //scm { + // url "${github}.git" + // connection "scm:git:${github}.git" + //} + /* + licenses { + license { + name 'The Apache Software License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution 'repo' + } + } + developers { + developer { + id 'dreamstalker' + name 'dreamstalker' + } + } + */ + } + } + } + } } publishing { - repositories { - maven { - if (project.version.contains('dev')) { - url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-dev/" - } else { - url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/" - } - credentials { - username rootProject.repoCreds.getProperty('username') - password rootProject.repoCreds.getProperty('password') - } - } - } + repositories { + maven { + if (project.version.contains('dev')) { + url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-dev/" + } else { + url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/" + } + credentials { + username rootProject.repoCreds.getProperty('username') + password rootProject.repoCreds.getProperty('password') + } + } + } } tasks.withType(AbstractCompile) { - options.encoding = 'UTF-8' + options.encoding = 'UTF-8' } diff --git a/publish.gradle b/publish.gradle index d5fbdf3..ee6d0bd 100644 --- a/publish.gradle +++ b/publish.gradle @@ -2,154 +2,154 @@ import org.doomedsociety.gradlecpp.GradleCppUtils import org.apache.commons.io.FilenameUtils void _copyFileToDir(String from, String to) { - def dst = new File(project.file(to), FilenameUtils.getName(from)) - GradleCppUtils.copyFile(project.file(from), dst, false) + def dst = new File(project.file(to), FilenameUtils.getName(from)) + GradleCppUtils.copyFile(project.file(from), dst, false) } 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 { - dependsOn ':flightrec/decoder:uberjar' - doLast { - def pubRootDir = project.file('publish/publishRoot') - if (pubRootDir.exists()) { - if (!pubRootDir.deleteDir()) { - throw new RuntimeException("Failed to delete ${pubRootDir}") - } - } + dependsOn ':flightrec/decoder:uberjar' + doLast { + def pubRootDir = project.file('publish/publishRoot') + if (pubRootDir.exists()) { + if (!pubRootDir.deleteDir()) { + throw new RuntimeException("Failed to delete ${pubRootDir}") + } + } - pubRootDir.mkdirs() + pubRootDir.mkdirs() - //bugfixed binaries - project.file('publish/publishRoot/bin/bugfixed').mkdirs() - _copyFileToDir('publish/releaseRehldsFixes/swds.dll', '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') + //bugfixed binaries + project.file('publish/publishRoot/bin/bugfixed').mkdirs() + _copyFileToDir('publish/releaseRehldsFixes/swds.dll', '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') - //pure binaries - project.file('publish/publishRoot/bin/pure').mkdirs() - _copyFileToDir('publish/releaseRehldsNofixes/swds.dll', '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') + //pure binaries + project.file('publish/publishRoot/bin/pure').mkdirs() + _copyFileToDir('publish/releaseRehldsNofixes/swds.dll', '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') - //hlsdk - project.file('publish/publishRoot/hlsdk').mkdirs() - copy { - from 'rehlds/common' - into 'publish/publishRoot/hlsdk/common' - } - copy { - from 'rehlds/dlls' - into 'publish/publishRoot/hlsdk/dlls' - } - copy { - from 'rehlds/pm_shared' - into 'publish/publishRoot/hlsdk/pm_shared' - } - copy { - from 'rehlds/public' - into 'publish/publishRoot/hlsdk/public' - exclude '**/rehlds/*', '**/tier0/*' - } - copy { - from 'rehlds/public/rehlds' - into 'publish/publishRoot/hlsdk/engine' - } + //hlsdk + project.file('publish/publishRoot/hlsdk').mkdirs() + copy { + from 'rehlds/common' + into 'publish/publishRoot/hlsdk/common' + } + copy { + from 'rehlds/dlls' + into 'publish/publishRoot/hlsdk/dlls' + } + copy { + from 'rehlds/pm_shared' + into 'publish/publishRoot/hlsdk/pm_shared' + } + copy { + from 'rehlds/public' + into 'publish/publishRoot/hlsdk/public' + exclude '**/rehlds/*', '**/tier0/*' + } + copy { + from 'rehlds/public/rehlds' + into 'publish/publishRoot/hlsdk/engine' + } - //flightrecorder + //flightrecorder - def flightRecJarTask = project(':flightrec/decoder').tasks.getByName('uberjar') - println flightRecJarTask - println flightRecJarTask.class.name - File flightRecJarFile = flightRecJarTask.archivePath - project.file('publish/publishRoot/flighrec').mkdirs() - GradleCppUtils.copyFile(flightRecJarFile, project.file('publish/publishRoot/flighrec/decoder.jar'), false) - copy { - from new File(project(':flightrec/decoder').projectDir, 'pub') - into 'publish/publishRoot/flighrec' - } - } + def flightRecJarTask = project(':flightrec/decoder').tasks.getByName('uberjar') + println flightRecJarTask + println flightRecJarTask.class.name + File flightRecJarFile = flightRecJarTask.archivePath + project.file('publish/publishRoot/flighrec').mkdirs() + GradleCppUtils.copyFile(flightRecJarFile, project.file('publish/publishRoot/flighrec/decoder.jar'), false) + copy { + from new File(project(':flightrec/decoder').projectDir, 'pub') + into 'publish/publishRoot/flighrec' + } + } } task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') { - baseName = "rehlds-dist-${project.version}" - destinationDir file('publish') - from 'publish/publishRoot' + baseName = "rehlds-dist-${project.version}" + destinationDir file('publish') + from 'publish/publishRoot' } publishing { - publications { - maven(MavenPublication) { - version project.version - artifact publishPackage + publications { + maven(MavenPublication) { + version project.version + artifact publishPackage - pom.withXml { - asNode().children().last() + { - resolveStrategy = DELEGATE_FIRST - name project.name - description project.description - properties { - commitDate project.ext.rehldsVersionInfo.commitDate - commitSHA project.ext.rehldsVersionInfo.commitSHA - } + pom.withXml { + asNode().children().last() + { + resolveStrategy = DELEGATE_FIRST + name project.name + description project.description + properties { + commitDate project.ext.rehldsVersionInfo.commitDate + commitSHA project.ext.rehldsVersionInfo.commitSHA + } - //url github - //scm { - // url "${github}.git" - // connection "scm:git:${github}.git" - //} - /* - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution 'repo' - } - } - developers { - developer { - id 'dreamstalker' - name 'dreamstalker' - } - } - */ - } - } - } - } + //url github + //scm { + // url "${github}.git" + // connection "scm:git:${github}.git" + //} + /* + licenses { + license { + name 'The Apache Software License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution 'repo' + } + } + developers { + developer { + id 'dreamstalker' + name 'dreamstalker' + } + } + */ + } + } + } + } } Properties repoCreds = new Properties() project.ext.repoCreds = repoCreds if (file('repo_creds.properties').exists()) { - println 'Loading maven repo credentials' - file('repo_creds.properties').withReader('UTF-8', { Reader r -> - repoCreds.load(r) - }) + println 'Loading maven repo credentials' + file('repo_creds.properties').withReader('UTF-8', { Reader r -> + repoCreds.load(r) + }) } publishing { - repositories { - maven { - if (project.version.contains('dev')) { - url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-dev/" - } else { - url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/" - } - credentials { - username repoCreds.getProperty('username') - password repoCreds.getProperty('password') - } - } - } + repositories { + maven { + if (project.version.contains('dev')) { + url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-dev/" + } else { + url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/" + } + credentials { + username repoCreds.getProperty('username') + password repoCreds.getProperty('password') + } + } + } } task doPublish { - dependsOn 'publishPackage' - if (repoCreds.getProperty('username') && repoCreds.getProperty('password')) { - dependsOn 'publish' - dependsOn ':flightrec/decoder_api:publish' - } + dependsOn 'publishPackage' + if (repoCreds.getProperty('username') && repoCreds.getProperty('password')) { + dependsOn 'publish' + dependsOn ':flightrec/decoder_api:publish' + } } diff --git a/rehlds/build.gradle b/rehlds/build.gradle index 53f977c..ec8bff9 100644 --- a/rehlds/build.gradle +++ b/rehlds/build.gradle @@ -23,6 +23,7 @@ import org.apache.commons.io.FilenameUtils apply plugin: 'cpp' apply plugin: IccCompilerPlugin +apply plugin: GccCompilerPlugin apply plugin: RehldsPlayTestPlugin apply plugin: gradlecpp.CppUnitTestPlugin @@ -33,303 +34,313 @@ repositories { } configurations { - rehlds_tests + rehlds_tests } dependencies { - rehlds_tests 'rehlds.testdemos:hl-phys-single1: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:shooting-hl-1: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:cstrike-muliplayer-1:1.1' + rehlds_tests 'rehlds.testdemos:shooting-hl-1:1.1' } project.ext.dep_bzip2 = project(':dep/bzip2') project.ext.dep_cppunitlite = project(':dep/cppunitlite') void createIntergrationTestTask(NativeBinarySpec b) { - boolean rehldsFixes = b.flavor.name.contains('rehldsFixes') + boolean rehldsFixes = b.flavor.name.contains('rehldsFixes') - if (!(b instanceof SharedLibraryBinarySpec)) return - if (!GradleCppUtils.windows) return - if (rehldsFixes) return + if (!(b instanceof SharedLibraryBinarySpec)) return + if (!GradleCppUtils.windows) return + if (rehldsFixes) return - def libLinkTask = GradleCppUtils.getLinkTask(b) - String unitTestTask = b.hasProperty('cppUnitTestTask') ? b.cppUnitTestTask : null + def libLinkTask = GradleCppUtils.getLinkTask(b) + String unitTestTask = b.hasProperty('cppUnitTestTask') ? b.cppUnitTestTask : null - def depFiles = [] - depFiles.addAll(libLinkTask.outputs.files.files) + def depFiles = [] + depFiles.addAll(libLinkTask.outputs.files.files) - def demoItgTestTask = project.tasks.create(b.namingScheme.getTaskName('demoItgTest'), RehldsPlayTestTask) - demoItgTestTask.with { - rehldsImageRoot = new File(project.projectDir, '_rehldsTestImg') - rehldsTestLogs = new File(this.project.buildDir, "_rehldsTestLogs/${b.name}") - testDemos = project.configurations.rehlds_tests - testFor = b + def demoItgTestTask = project.tasks.create(b.namingScheme.getTaskName('demoItgTest'), RehldsPlayTestTask) + demoItgTestTask.with { + rehldsImageRoot = new File(project.projectDir, '_rehldsTestImg') + rehldsTestLogs = new File(this.project.buildDir, "_rehldsTestLogs/${b.name}") + testDemos = project.configurations.rehlds_tests + testFor = b - //inputs/outputs for up-to-date check - inputs.files depFiles - inputs.files testDemos.files - outputs.dir rehldsTestLogs + //inputs/outputs for up-to-date check + inputs.files depFiles + inputs.files testDemos.files + outputs.dir rehldsTestLogs - //dependencies on library and test executable - dependsOn libLinkTask - if (unitTestTask) { - dependsOn unitTestTask - } + //dependencies on library and test executable + dependsOn libLinkTask + if (unitTestTask) { + dependsOn unitTestTask + } - postExtractAction { - def binaryOutFile = GradleCppUtils.getBinaryOutputFile(b) - GradleCppUtils.copyFile(binaryOutFile, new File(rehldsImageRoot, binaryOutFile.name), true) - } - } + postExtractAction { + def binaryOutFile = GradleCppUtils.getBinaryOutputFile(b) + GradleCppUtils.copyFile(binaryOutFile, new File(rehldsImageRoot, binaryOutFile.name), true) + } + } - b.buildTask.dependsOn demoItgTestTask + b.buildTask.dependsOn demoItgTestTask } void setupUnitTests(NativeBinarySpec bin) { - boolean unitTestExecutable = bin.component.name.endsWith('_tests') - if (!unitTestExecutable) return + boolean unitTestExecutable = bin.component.name.endsWith('_tests') + if (!unitTestExecutable) return - GradleCppUtils.getLinkTask(bin).doLast { - 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') - GradleCppUtils.copyFile(srcPath, dstPath, true) - } + GradleCppUtils.getLinkTask(bin).doLast { + 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') + GradleCppUtils.copyFile(srcPath, dstPath, true) + } } void postEvaluate(NativeBinarySpec b) { - // attach generateAppVersion task to all 'compile source' tasks - GradleCppUtils.getCompileTasks(b).each { Task t -> - t.dependsOn project.generateAppVersion - } + // attach generateAppVersion task to all 'compile source' tasks + GradleCppUtils.getCompileTasks(b).each { Task t -> + t.dependsOn project.generateAppVersion + } - setupUnitTests(b) - createIntergrationTestTask(b) + setupUnitTests(b) + createIntergrationTestTask(b) } void setupToolchain(NativeBinarySpec b) { - boolean unitTestExecutable = b.component.name.endsWith('_tests') - boolean swdsLib = b.name.toLowerCase().contains('swds') - boolean rehldsFixes = b.flavor.name.contains('rehldsFixes') + boolean useGcc = project.hasProperty("useGcc") + boolean unitTestExecutable = b.component.name.endsWith('_tests') + boolean swdsLib = b.name.toLowerCase().contains('swds') + boolean rehldsFixes = b.flavor.name.contains('rehldsFixes') - ToolchainConfig cfg = rootProject.createToolchainConfig(b) - cfg.projectInclude(project, '', '/public/rehlds', '/engine', '/common', '/pm_shared', '/rehlds', '/testsuite', '/hookers', '/public') - cfg.projectInclude(dep_bzip2, '/include') + ToolchainConfig cfg = rootProject.createToolchainConfig(b) + cfg.projectInclude(project, '', '/public/rehlds', '/engine', '/common', '/pm_shared', '/rehlds', '/testsuite', '/hookers', '/public') + cfg.projectInclude(dep_bzip2, '/include') - if (unitTestExecutable) { - cfg.projectInclude(dep_cppunitlite, '/include') - b.lib LazyNativeDepSet.create(dep_cppunitlite, 'cppunitlite', b.buildType.name, true) - } - b.lib LazyNativeDepSet.create(dep_bzip2, 'bzip2', b.buildType.name, true) + if (unitTestExecutable) { + cfg.projectInclude(dep_cppunitlite, '/include') + b.lib LazyNativeDepSet.create(dep_cppunitlite, 'cppunitlite', 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) { - cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( - enabled: true, - pchHeader: 'precompiled.h', - pchSourceSet: 'rehlds_pch' - ) - cfg.singleDefines('_CRT_SECURE_NO_WARNINGS') - if (!rehldsFixes) { - cfg.compilerOptions.floatingPointModel = FloatingPointModel.PRECISE - cfg.compilerOptions.enhancedInstructionsSet = EnhancedInstructionsSet.DISABLED - } else { + if (cfg instanceof MsvcToolchainConfig) { + cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( + enabled: true, + pchHeader: 'precompiled.h', + pchSourceSet: 'rehlds_pch' + ) + cfg.singleDefines('_CRT_SECURE_NO_WARNINGS') + if (!rehldsFixes) { + cfg.compilerOptions.floatingPointModel = FloatingPointModel.PRECISE + cfg.compilerOptions.enhancedInstructionsSet = EnhancedInstructionsSet.DISABLED + } else { cfg.compilerOptions.args '/Oi', '/GF', '/GR-', '/GS-' } - if (swdsLib) { - cfg.linkerOptions.randomizedBaseAddress = false - cfg.linkerOptions.baseAddress = '0x4970000' - } - cfg.projectLibpath(project, '/lib') - cfg.extraLibs 'steam_api.lib', 'psapi.lib', 'ws2_32.lib', 'kernel32.lib', 'user32.lib', 'advapi32.lib', 'libacof32.lib' - } else if (cfg instanceof GccToolchainConfig) { - cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions( - enabled: true, - pchSourceSet: 'rehlds_pch' - ) - cfg.compilerOptions.languageStandard = 'c++0x' - cfg.defines([ - '_stricmp': 'strcasecmp', - '_strnicmp': 'strncasecmp', - '_strdup': 'strdup', - '_unlink': 'unlink', - '_vsnprintf': 'vsnprintf', - ]) - 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 (swdsLib) { + cfg.linkerOptions.randomizedBaseAddress = false + cfg.linkerOptions.baseAddress = '0x4970000' + } + cfg.projectLibpath(project, '/lib') + cfg.extraLibs 'steam_api.lib', 'psapi.lib', 'ws2_32.lib', 'kernel32.lib', 'user32.lib', 'advapi32.lib', 'libacof32.lib' + } else if (cfg instanceof GccToolchainConfig) { + if (!useGcc) { + cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions( + enabled: true, + pchSourceSet: 'rehlds_pch' + ) + } + cfg.compilerOptions.languageStandard = 'c++0x' + cfg.defines([ + '_stricmp': 'strcasecmp', + '_strnicmp': 'strncasecmp', + '_strdup': 'strdup', + '_unlink': 'unlink', + '_vsnprintf': 'vsnprintf', + ]) + 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) { - cfg.singleDefines 'HOOK_ENGINE' - } + if (!unitTestExecutable && !swdsLib) { + cfg.singleDefines 'HOOK_ENGINE' + } if (unitTestExecutable) { cfg.singleDefines 'REHLDS_UNIT_TESTS' } - if (rehldsFixes) { - cfg.singleDefines 'REHLDS_FIXES', 'REHLDS_CHECKS' - } + if (rehldsFixes) { + cfg.singleDefines 'REHLDS_FIXES', 'REHLDS_CHECKS' + } - ToolchainConfigUtils.apply(project, cfg, b) + ToolchainConfigUtils.apply(project, cfg, b) - GradleCppUtils.onTasksCreated(project, 'postEvaluate', { - postEvaluate(b) - }) + GradleCppUtils.onTasksCreated(project, 'postEvaluate', { + postEvaluate(b) + }) } class RehldsSrc { - static void rehlds_src(def h) { - h.rehlds_src(CppSourceSet) { - source { - srcDirs "engine", "rehlds", "public", "version" - if (GradleCppUtils.windows) srcDirs "testsuite" + static void rehlds_src(def h) { + h.rehlds_src(CppSourceSet) { + source { + srcDirs "engine", "rehlds", "public", "version" + if (GradleCppUtils.windows) srcDirs "testsuite" - include "**/*.cpp" - exclude "precompiled.cpp" - exclude GradleCppUtils.windows ? "tier0/platform_linux.cpp" : "tier0/platform_win32.cpp" + include "**/*.cpp" + exclude "precompiled.cpp" + exclude GradleCppUtils.windows ? "tier0/platform_linux.cpp" : "tier0/platform_win32.cpp" exclude "interface.cpp", "rehlds/crc32c.cpp", "rehlds/sys_shared.cpp" - } + } - source { - srcDirs "hookers" - include "**/*.cpp" - exclude "6132_hooker.cpp", "hooker.cpp", "main.cpp", "main_swds.cpp" - if (!GradleCppUtils.windows) exclude "rehlds_debug.cpp" - } - } - } + source { + srcDirs "hookers" + include "**/*.cpp" + exclude "6132_hooker.cpp", "hooker.cpp", "main.cpp", "main_swds.cpp" + if (!GradleCppUtils.windows) exclude "rehlds_debug.cpp" + } + } + } - static void rehlds_pch(def h) { - h.rehlds_pch(CppSourceSet) { - source { - srcDirs "rehlds" - include "precompiled.cpp" - } - } - } + static void rehlds_pch(def h) { + h.rehlds_pch(CppSourceSet) { + source { + srcDirs "rehlds" + include "precompiled.cpp" + } + } + } - static void rehlds_hooker_src(def h) { - h.rehlds_hooker_src(CppSourceSet) { - source { - srcDirs "hookers" - include "6132_hooker.cpp", "hooker.cpp" - } - } - } + static void rehlds_hooker_src(def h) { + h.rehlds_hooker_src(CppSourceSet) { + source { + srcDirs "hookers" + include "6132_hooker.cpp", "hooker.cpp" + } + } + } - static void rehlds_hooker_main_src(def h) { - h.rehlds_hooker_main_src(CppSourceSet) { - source { - srcDirs "hookers" - include "main.cpp" - } - } - } + static void rehlds_hooker_main_src(def h) { + h.rehlds_hooker_main_src(CppSourceSet) { + source { + srcDirs "hookers" + include "main.cpp" + } + } + } - static void rehlds_swds_main_src(def h) { - h.rehlds_swds_main_src(CppSourceSet) { - source { - srcDirs "hookers" - include "main_swds.cpp" - } - } - } + static void rehlds_swds_main_src(def h) { + h.rehlds_swds_main_src(CppSourceSet) { + source { + srcDirs "hookers" + include "main_swds.cpp" + } + } + } - static void rehlds_tests_src(def h) { - h.rehlds_tests_src(CppSourceSet) { - source { - srcDir "unittests" - include "**/*.cpp" - } - } - } + static void rehlds_tests_src(def h) { + h.rehlds_tests_src(CppSourceSet) { + source { + srcDir "unittests" + include "**/*.cpp" + } + } + } } model { - buildTypes { - debug - release - } + buildTypes { + debug + release + } - platforms { - x86 { - architecture "x86" - } - } + platforms { + x86 { + architecture "x86" + } + } - toolChains { - visualCpp(VisualCpp) { - } - icc(Icc) { - } - } + toolChains { + visualCpp(VisualCpp) + if (project.hasProperty("useGcc")) { + gcc(Gcc) + } else { + icc(Icc) + } + } - flavors { - rehldsNofixes - rehldsFixes - } + flavors { + rehldsNofixes + rehldsFixes + } - components { - rehlds_hooker_engine(NativeLibrarySpec) { - targetPlatform 'x86' - baseName 'FileSystem_Stdio' + components { + rehlds_hooker_engine(NativeLibrarySpec) { + targetPlatform 'x86' + baseName 'FileSystem_Stdio' - sources { - RehldsSrc.rehlds_pch(it) - RehldsSrc.rehlds_src(it) - RehldsSrc.rehlds_hooker_src(it) - RehldsSrc.rehlds_hooker_main_src(it) - } + sources { + RehldsSrc.rehlds_pch(it) + RehldsSrc.rehlds_src(it) + RehldsSrc.rehlds_hooker_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) { - targetPlatform 'x86' - baseName GradleCppUtils.windows ? 'swds' : 'engine_i486' + rehlds_swds_engine(NativeLibrarySpec) { + targetPlatform 'x86' + baseName GradleCppUtils.windows ? 'swds' : 'engine_i486' - sources { - RehldsSrc.rehlds_pch(it) - RehldsSrc.rehlds_src(it) - RehldsSrc.rehlds_swds_main_src(it) - } + sources { + RehldsSrc.rehlds_pch(it) + RehldsSrc.rehlds_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) { - targetPlatform 'x86' - sources { - RehldsSrc.rehlds_pch(it) - RehldsSrc.rehlds_src(it) - RehldsSrc.rehlds_tests_src(it) - } + rehlds_hooker_engine_tests(NativeExecutableSpec) { + targetPlatform 'x86' + sources { + RehldsSrc.rehlds_pch(it) + RehldsSrc.rehlds_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) { - targetPlatform 'x86' - sources { - RehldsSrc.rehlds_pch(it) - RehldsSrc.rehlds_src(it) - RehldsSrc.rehlds_tests_src(it) - } + rehlds_swds_engine_tests(NativeExecutableSpec) { + targetPlatform 'x86' + sources { + RehldsSrc.rehlds_pch(it) + RehldsSrc.rehlds_src(it) + RehldsSrc.rehlds_tests_src(it) + } - binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } - } - } + binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } + } + } } 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') - } + } } task buildFixes { @@ -351,21 +362,21 @@ gradle.taskGraph.whenReady { graph -> } task prepareDevEnvTests { - def rehldsTests = new File(project.projectDir, '_dev/testDemos') + def rehldsTests = new File(project.projectDir, '_dev/testDemos') - inputs.files configurations.rehlds_tests.files - outputs.dir rehldsTests + inputs.files configurations.rehlds_tests.files + outputs.dir rehldsTests - doLast { - rehldsTests.mkdirs() - configurations.rehlds_tests.files.each { File f -> - def t = zipTree(f) - copy { - into new File(rehldsTests, FilenameUtils.getBaseName(f.absolutePath)) - from t - } - } - } + doLast { + rehldsTests.mkdirs() + configurations.rehlds_tests.files.each { File f -> + def t = zipTree(f) + copy { + into new File(rehldsTests, FilenameUtils.getBaseName(f.absolutePath)) + from t + } + } + } } task prepareDevEnvEngine << { @@ -378,40 +389,40 @@ task prepareDevEnvEngine << { } task prepareDevEnv { - dependsOn prepareDevEnvEngine, prepareDevEnvTests + dependsOn prepareDevEnvEngine, prepareDevEnvTests } tasks.clean.doLast { - project.file('version/appversion.h').delete() + project.file('version/appversion.h').delete() } task generateAppVersion { - RehldsVersionInfo verInfo = (RehldsVersionInfo) rootProject.rehldsVersionInfo + RehldsVersionInfo verInfo = (RehldsVersionInfo) rootProject.rehldsVersionInfo - def tplFile = project.file('version/appversion.vm') - def renderedFile = project.file('version/appversion.h') + def tplFile = project.file('version/appversion.vm') + def renderedFile = project.file('version/appversion.h') - // check to up-to-date - inputs.file tplFile - inputs.file project.file('gradle.properties') - outputs.file renderedFile + // check to up-to-date + inputs.file tplFile + inputs.file project.file('gradle.properties') + outputs.file renderedFile - // this will ensure that this task is redone when the versions change - inputs.property('version', rootProject.version) - inputs.property('commitDate', verInfo.asCommitDate()) + // this will ensure that this task is redone when the versions change + inputs.property('version', rootProject.version) + inputs.property('commitDate', verInfo.asCommitDate()) - println "##teamcity[buildNumber '" + verInfo.asMavenVersion(false) + "']"; + println "##teamcity[buildNumber '" + verInfo.asMavenVersion(false) + "']"; - doLast { + doLast { - def templateCtx = [ - verInfo : verInfo - ] + def templateCtx = [ + verInfo : verInfo + ] - def content = VelocityUtils.renderTemplate(tplFile, templateCtx) - renderedFile.delete() - renderedFile.write(content, 'utf-8') + def content = VelocityUtils.renderTemplate(tplFile, templateCtx) + renderedFile.delete() + 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 + ')'; + } } diff --git a/rehlds/common/mathlib.h b/rehlds/common/mathlib.h index 6d19b3f..83affe8 100644 --- a/rehlds/common/mathlib.h +++ b/rehlds/common/mathlib.h @@ -65,32 +65,31 @@ typedef union DLONG_u #endif template -inline T min(T a, T b) { +inline T min(T a, T b) +{ return (a < b) ? a : b; } template -inline T max(T a, T b) { +inline T max(T a, T b) +{ return (a < b) ? b : a; } template -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; } template -inline T bswap(T s) { - switch (sizeof(T)) { -#ifdef _WIN32 - case 2: {auto res = _byteswap_ushort(*(uint16 *)&s); return *(T *)&res;} - case 4: {auto res = _byteswap_ulong(*(uint32 *)(&s)); return *(T *)&res;} - case 8: {auto res = _byteswap_uint64(*(uint64 *)&s); return *(T *)&res;} -#else - 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 +inline T bswap(T s) +{ + switch (sizeof(T)) + { + case 2: {auto res = __builtin_bswap16(*(uint16 *)&s); return *(T *)&res; } + case 4: {auto res = __builtin_bswap32(*(uint32 *)&s); return *(T *)&res; } + case 8: {auto res = __builtin_bswap64(*(uint64 *)&s); return *(T *)&res; } default: return s; } } diff --git a/rehlds/engine/cl_null.cpp b/rehlds/engine/cl_null.cpp index 29c8e85..227fd86 100644 --- a/rehlds/engine/cl_null.cpp +++ b/rehlds/engine/cl_null.cpp @@ -52,7 +52,7 @@ cvar_t console; #endif //HOOK_ENGINE -void CL_RecordHUDCommand(char *cmdname) { } +void CL_RecordHUDCommand(const char *cmdname) { } void R_DecalRemoveAll(int textureIndex) { } void CL_CheckForResend(void) { } qboolean CL_CheckFile(sizebuf_t *msg, char *filename) { return 1; } diff --git a/rehlds/engine/client.h b/rehlds/engine/client.h index 8e95c4b..2c7ea63 100644 --- a/rehlds/engine/client.h +++ b/rehlds/engine/client.h @@ -289,7 +289,7 @@ extern cvar_t cl_name; extern cvar_t rate_; extern cvar_t console; -void CL_RecordHUDCommand(char *cmdname); +void CL_RecordHUDCommand(const char *cmdname); void R_DecalRemoveAll(int textureIndex); void CL_CheckForResend(void); qboolean CL_CheckFile(sizebuf_t *msg, char *filename); diff --git a/rehlds/engine/cmd.cpp b/rehlds/engine/cmd.cpp index 09520bf..38eaa08 100644 --- a/rehlds/engine/cmd.cpp +++ b/rehlds/engine/cmd.cpp @@ -63,7 +63,7 @@ void Cbuf_AddText(char *text) if (cmd_text.cursize + len >= cmd_text.maxsize) { - Con_Printf(__FUNCTION__ ": overflow\n"); + Con_Printf("%s: overflow\n", __func__); return; } @@ -81,7 +81,7 @@ void Cbuf_InsertText(char *text) if (cmd_text.cursize + addLen >= cmd_text.maxsize) { - Con_Printf(__FUNCTION__ ": overflow\n"); + Con_Printf("%s: overflow\n", __func__); return; } @@ -119,7 +119,7 @@ void Cbuf_InsertTextLines(char *text) if (cmd_text.cursize + addLen + 2 >= cmd_text.maxsize) { - Con_Printf(__FUNCTION__ ": overflow\n"); + Con_Printf("%s: overflow\n", __func__); return; } @@ -417,7 +417,7 @@ void Cmd_Echo_f(void) Con_Printf("\n"); } -char *CopyString(char *in) +char *CopyString(const char *in) { char *out = (char *)Z_Malloc(Q_strlen(in) + 1); 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; @@ -669,7 +669,7 @@ NOXREF cmd_function_t *Cmd_FindCmd(char *cmd_name) return NULL; } -cmd_function_t *Cmd_FindCmdPrev(char *cmd_name) +cmd_function_t *Cmd_FindCmdPrev(const char *cmd_name) { 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. -void Cmd_AddCommand(char *cmd_name, xcommand_t function) +void Cmd_AddCommand(const char *cmd_name, xcommand_t function) { cmd_function_t *cmd; if (host_initialized) { - Sys_Error(__FUNCTION__ " after host_initialized"); + Sys_Error("%s: called after host_initialized", __func__); } // Check in variables list 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; } // Check if this command is already defined 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; } @@ -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. -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; // Check in variables list 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; } // Check if this command is already defined 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; } @@ -775,26 +775,26 @@ void Cmd_AddMallocCommand(char *cmd_name, xcommand_t function, int flag) 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; 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; 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); } -void EXT_FUNC Cmd_RemoveCmd(char *cmd_name) +void EXT_FUNC Cmd_RemoveCmd(const char *cmd_name) { auto prev = Cmd_FindCmdPrev(cmd_name); @@ -802,7 +802,7 @@ void EXT_FUNC Cmd_RemoveCmd(char *cmd_name) auto cmd = prev->next; prev->next = cmd->next; - Z_Free(cmd->name); + Z_Free((void*)cmd->name); Mem_Free(cmd); } } @@ -818,7 +818,7 @@ void Cmd_RemoveMallocedCmds(int flag) if (c->flags & flag) { *p = c->next; - Z_Free(c->name); + Z_Free((void*)c->name); Mem_Free(c); c = *p; continue; @@ -862,7 +862,7 @@ qboolean Cmd_Exists(const char *cmd_name) return FALSE; } -NOXREF char *Cmd_CompleteCommand(char *search, int forward) +NOXREF const char *Cmd_CompleteCommand(char *search, int forward) { NOXREFCHECK; @@ -1007,10 +1007,12 @@ qboolean Cmd_ForwardToServerInternal(sizebuf_t *pBuf) return FALSE; } - char tempData[4096]; + char tempData[4096], buffername[64]; sizebuf_t tempBuf; - tempBuf.buffername = __FUNCTION__ "::tempBuf"; + Q_sprintf(buffername, "%s::%s", __func__, nameof_variable(tempBuf)); + + tempBuf.buffername = buffername; tempBuf.data = (byte *)tempData; tempBuf.maxsize = 4096; tempBuf.cursize = 0; @@ -1061,7 +1063,7 @@ NOXREF int Cmd_CheckParm(char *parm) if (!parm) { - Sys_Error(__FUNCTION__ ": NULL"); + Sys_Error("%s: NULL", __func__); } int c = Cmd_Argc(); diff --git a/rehlds/engine/cmd.h b/rehlds/engine/cmd.h index 6d874dd..ececf8f 100644 --- a/rehlds/engine/cmd.h +++ b/rehlds/engine/cmd.h @@ -93,7 +93,7 @@ void Cbuf_Execute(void); void Cmd_StuffCmds_f(void); void Cmd_Exec_f(void); void Cmd_Echo_f(void); -char *CopyString(char *in); +char *CopyString(const char *in); void Cmd_Alias_f(void); struct cmd_function_s *Cmd_GetFirstCmd(void); void Cmd_Init(void); @@ -102,20 +102,20 @@ int Cmd_Argc(void); const char *Cmd_Argv(int arg); const char *Cmd_Args(void); void Cmd_TokenizeString(char *text); -NOXREF cmd_function_t *Cmd_FindCmd(char *cmd_name); -cmd_function_t *Cmd_FindCmdPrev(char *cmd_name); -void Cmd_AddCommand(char *cmd_name, xcommand_t function); -void Cmd_AddMallocCommand(char *cmd_name, xcommand_t function, int flag); -NOXREF void Cmd_AddHUDCommand(char *cmd_name, xcommand_t function); -NOXREF void Cmd_AddWrapperCommand(char *cmd_name, xcommand_t function); -void Cmd_AddGameCommand(char *cmd_name, xcommand_t function); -void Cmd_RemoveCmd(char *cmd_name); +NOXREF cmd_function_t *Cmd_FindCmd(const char *cmd_name); +cmd_function_t *Cmd_FindCmdPrev(const char *cmd_name); +void Cmd_AddCommand(const char *cmd_name, xcommand_t function); +void Cmd_AddMallocCommand(const char *cmd_name, xcommand_t function, int flag); +NOXREF void Cmd_AddHUDCommand(const char *cmd_name, xcommand_t function); +NOXREF void Cmd_AddWrapperCommand(const char *cmd_name, xcommand_t function); +void Cmd_AddGameCommand(const char *cmd_name, xcommand_t function); +void Cmd_RemoveCmd(const char *cmd_name); void Cmd_RemoveMallocedCmds(int flag); NOXREF void Cmd_RemoveHudCmds(void); void Cmd_RemoveGameCmds(void); void Cmd_RemoveWrapperCmds(void); 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); qboolean Cmd_ForwardToServerInternal(sizebuf_t *pBuf); void Cmd_ForwardToServer(void); diff --git a/rehlds/engine/cmodel.cpp b/rehlds/engine/cmodel.cpp index 8bd9edf..513163c 100644 --- a/rehlds/engine/cmodel.cpp +++ b/rehlds/engine/cmodel.cpp @@ -54,7 +54,7 @@ unsigned char *Mod_DecompressVis(unsigned char *in, model_t *model) 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); diff --git a/rehlds/engine/common.cpp b/rehlds/engine/common.cpp index aad8c50..4b36514 100644 --- a/rehlds/engine/common.cpp +++ b/rehlds/engine/common.cpp @@ -651,7 +651,7 @@ void MSG_WriteBitAngle(float fAngle, int numbits) { 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); @@ -759,7 +759,7 @@ uint32 MSG_ReadBits(int numbits) #ifdef REHLDS_FIXES if (numbits > 32) { - Sys_Error(__FUNCTION__ ": invalid numbits %d\n", numbits); + Sys_Error("%s: invalid numbits %d\n", __func__, numbits); } #endif // REHLDS_FIXES @@ -1243,7 +1243,7 @@ void *EXT_FUNC SZ_GetSpace(sizebuf_t *buf, int length) 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) @@ -1253,32 +1253,32 @@ void *EXT_FUNC SZ_GetSpace(sizebuf_t *buf, int length) { 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) { - 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 { - 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) { - 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 if (!(buf->flags & SIZEBUF_ALLOW_OVERFLOW)) { 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 { - 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)) { - 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 - Con_Printf(__FUNCTION__ ": overflow on %s\n", buffername); + Con_Printf("%s: overflow on %s\n", __func__, buffername); SZ_Clear(buf); buf->flags |= SIZEBUF_OVERFLOWED; @@ -1707,7 +1707,7 @@ int COM_TokenWaiting(char *buffer) return 0; } -int COM_CheckParm(char *parm) +int COM_CheckParm(const char *parm) { int i; @@ -1874,13 +1874,13 @@ NOXREF void COM_WriteFile(char *filename, void *data, int len) if (fp) { - Sys_Printf(__FUNCTION__ ": %s\n", path); + Sys_Printf("%s: %s\n", __func__, path); FS_Write(data, len, 1, fp); FS_Close(fp); } 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 FS_Close(hFile); #endif - Sys_Error(__FUNCTION__ ": bad usehunk"); + Sys_Error("%s: bad usehunk", __func__); } if (!buf) @@ -2058,7 +2058,7 @@ unsigned char* EXT_FUNC COM_LoadFile(const char *path, int usehunk, int *pLength #ifdef REHLDS_FIXES FS_Close(hFile); #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); @@ -2129,7 +2129,7 @@ NOXREF unsigned char *COM_LoadFileLimit(char *path, int pos, int cbmax, int *pcb #ifdef REHLDS_FIXES FS_Close(hFile); #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); @@ -2152,7 +2152,7 @@ NOXREF unsigned char *COM_LoadFileLimit(char *path, int pos, int cbmax, int *pcb #ifdef REHLDS_FIXES FS_Close(hFile); #endif - Sys_Error(__FUNCTION__ ": not enough space for %s", path); + Sys_Error("%s: not enough space for %s", __func__, path); } FS_Close(hFile); @@ -2228,7 +2228,7 @@ void COM_StripTrailingSlash(char *ppath) void COM_ParseDirectoryFromCmd(const char *pCmdName, char *pDirName, const char *pDefault) { const char *pParameter = NULL; - int cmdParameterIndex = COM_CheckParm((char *)pCmdName); + int cmdParameterIndex = COM_CheckParm(pCmdName); if (cmdParameterIndex && cmdParameterIndex < com_argc - 1) { diff --git a/rehlds/engine/common.h b/rehlds/engine/common.h index 60e11a0..3ea8174 100644 --- a/rehlds/engine/common.h +++ b/rehlds/engine/common.h @@ -306,7 +306,7 @@ void COM_UngetToken(void); char *COM_Parse(char *data); char *COM_ParseLine(char *data); 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_Init(char *basedir); char *va(char *format, ...); diff --git a/rehlds/engine/crc.cpp b/rehlds/engine/crc.cpp index e1e6119..1c3b9ce 100644 --- a/rehlds/engine/crc.cpp +++ b/rehlds/engine/crc.cpp @@ -133,7 +133,7 @@ byte COM_BlockSequenceCRCByte(byte *base, int length, int sequence) CRC32_t crc; if (sequence < 0) - Sys_Error("sequence < 0, in COM_BlockSequenceCRCByte\n"); + Sys_Error("%s: sequence < 0\n", __func__); p = (byte *)pulCRCTable + sequence % 0x3FC; if (length > 60) length = 60; diff --git a/rehlds/engine/cvar.cpp b/rehlds/engine/cvar.cpp index 98aafdc..d72ccc2 100644 --- a/rehlds/engine/cvar.cpp +++ b/rehlds/engine/cvar.cpp @@ -309,7 +309,7 @@ void Cvar_Set(const char *var_name, const char *value) if (!var) { - Con_DPrintf(__FUNCTION__ ": variable \"%s\" not found\n", var_name); + Con_DPrintf("%s: variable \"%s\" not found\n", __func__, var_name); return; } @@ -351,7 +351,7 @@ void EXT_FUNC Cvar_RegisterVariable(cvar_t *variable) 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; } diff --git a/rehlds/engine/decals.cpp b/rehlds/engine/decals.cpp index ce468eb..7210f50 100644 --- a/rehlds/engine/decals.cpp +++ b/rehlds/engine/decals.cpp @@ -78,7 +78,7 @@ void Draw_CacheWadInitFromFile(FileHandle_t hFile, int len, char *name, int cach #ifdef REHLDS_FIXES FS_Close(hFile); #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); @@ -103,7 +103,7 @@ void Draw_CacheWadInit(char *name, int cacheMax, cachewad_t *wad) int len; FileHandle_t hFile = FS_Open(name, "rb"); 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); Draw_CacheWadInitFromFile(hFile, len, name, cacheMax, wad); FS_Close(hFile); @@ -180,7 +180,7 @@ void Draw_MiptexTexture(cachewad_t *wad, unsigned char *data) byte *pal; 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; 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]); 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; nSize = *(u_short *)&data[wad->cacheExtra + 40 + palette]; pal = (byte *)tex + paloffset; @@ -228,6 +228,7 @@ void Draw_MiptexTexture(cachewad_t *wad, unsigned char *data) if (gfCustomBuild) GL_UnloadTexture(tex); paloffset = GL_LoadTexture2(data, GLT_DECAL, tex->width, tex->height, v8, TRUE, 3, pal, gl_filter_max); + } else { tex->name[0] = '{'; @@ -273,14 +274,14 @@ void Draw_FreeWad(cachewad_t *pWad) } if (pWad->cache) { - #ifndef SWDS +#ifndef SWDS if (pWad->tempWad) { Mem_Free(pWad->cache); pWad->cache = NULL; return; } - #endif // SWDS +#endif // SWDS for (i = 0, pic = pWad->cache; i < pWad->cacheCount; i++, pic++) { if (Cache_Check(&pic->cache)) @@ -310,7 +311,7 @@ NOXREF int Draw_DecalIndex(int id) char tmp[32]; char *pName; 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]; 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; 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); if (!retval) @@ -382,7 +383,7 @@ int Draw_CacheByIndex(cachewad_t *wad, int nIndex, int playernum) if (i == wad->cacheCount) { 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++; 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; if (!pwad) - Sys_Error("Decal_MergeInDecals called with NULL wad\n"); + Sys_Error("%s: called with NULL wad\n", __func__); lumplist = NULL; if (!decal_wad) @@ -545,7 +546,7 @@ void Decal_Init(void) #else if (i == 0 && !hfile) #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 found = true; @@ -563,7 +564,7 @@ void Decal_Init(void) sv_decalnamecount = Draw_DecalCount(); 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++) { @@ -614,7 +615,7 @@ NOXREF void *Draw_CacheGet(cachewad_t *wad, int index) lumpinfo_t *pLump; 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; 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 (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; } } @@ -654,7 +655,7 @@ void *Draw_CustomCacheGet(cachewad_t *wad, void *raw, int rawsize, int index) char clean[16]; 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]; 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 (!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; } } @@ -696,9 +697,9 @@ NOXREF qboolean Draw_CacheReload(cachewad_t *wad, int i, lumpinfo_t *pLump, cach } else #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) - 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; 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) { - Con_Printf(__FUNCTION__ ": Bad cached wad %s\n", wad->name); + Con_Printf("%s: Bad cached wad %s\n", __func__, wad->name); 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]); pix = tex.width * tex.height; - pixoffset = pix + (pix>>2) + (pix>>4) + (pix>>6); - paloffset = (pix>>2) + tmp.offsets[0] + pix; - palettesize = (pix>>4) + paloffset; + pixoffset = pix + (pix >> 2) + (pix >> 4) + (pix >> 6); + paloffset = (pix >> 2) + tmp.offsets[0] + pix; + palettesize = (pix >> 4) + paloffset; nPalleteCount = *(u_short *)(data + pixoffset + sizeof(texture_t)); if (!tex.width || tex.width > 256 || tex.height > 256 || (tmp.offsets[0] + pix != tmp.offsets[1]) || 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; } 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; } nSize = pixoffset + LittleLong(tmp.offsets[0]) + 3 * nPalleteCount + 2; 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; } @@ -791,7 +792,7 @@ qboolean Draw_CacheLoadFromCustom(char *clean, cachewad_t *wad, void *raw, int r pLump = &wad->lumps[idx]; buf = (byte *)Cache_Alloc(&pic->cache, wad->cacheExtra + pLump->size + 1, clean); 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; 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 (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++; Q_strncpy(wad->name, path, 63); diff --git a/rehlds/engine/delta.cpp b/rehlds/engine/delta.cpp index 268ca07..d6f029d 100644 --- a/rehlds/engine/delta.cpp +++ b/rehlds/engine/delta.cpp @@ -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; } @@ -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; } @@ -471,7 +471,7 @@ int DELTA_TestDelta(unsigned char *from, unsigned char *to, delta_t *pFields) } break; default: - Con_Printf(__FUNCTION__ ": Bad field type %i\n", fieldType); + Con_Printf("%s: Bad field type %i\n", __func__, fieldType); break; } @@ -559,7 +559,7 @@ void DELTA_MarkSendFields(unsigned char *from, unsigned char *to, delta_t *pFiel pTest->flags |= FDT_MARK; break; default: - Con_Printf(__FUNCTION__ ": Bad field type %i\n", fieldType); + Con_Printf("%s: Bad field type %i\n", __func__, fieldType); break; } } @@ -715,7 +715,7 @@ void DELTA_WriteMarkedFields(unsigned char *from, unsigned char *to, delta_t *pF MSG_WriteBitString((const char *)&to[pTest->fieldOffset]); break; default: - Con_Printf(__FUNCTION__ ": unknown send field type\n"); + Con_Printf("%s: unknown send field type\n", __func__); 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]); break; default: - Con_Printf(__FUNCTION__ ": unparseable field type %i\n", fieldType); + Con_Printf("%s: unparseable field type %i\n", __func__, fieldType); } continue; } @@ -985,7 +985,7 @@ int DELTA_ParseDelta(unsigned char *from, unsigned char *to, delta_t *pFields) } while (c); break; default: - Con_Printf(__FUNCTION__ ": unparseable field type %i\n", fieldType); + Con_Printf("%s: unparseable field type %i\n", __func__, fieldType); break; } } @@ -1085,7 +1085,7 @@ delta_t *DELTA_BuildFromLinks(delta_link_t **pplinks) #ifdef REHLDS_FIXES 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 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) @@ -1150,11 +1150,11 @@ qboolean DELTA_ParseType(delta_description_t *pdelta, char **pstream) else if (!Q_stricmp(com_token, "DT_STRING")) pdelta->fieldType |= DT_STRING; 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 - 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; } @@ -1167,7 +1167,7 @@ qboolean DELTA_ParseField(int count, delta_definition_t *pdefinition, delta_link { 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; } @@ -1175,13 +1175,13 @@ qboolean DELTA_ParseField(int count, delta_definition_t *pdefinition, delta_link *pstream = COM_Parse(*pstream); 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); 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); @@ -1215,7 +1215,7 @@ qboolean DELTA_ParseField(int count, delta_definition_t *pdefinition, delta_link *pstream = COM_Parse(*pstream); 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; } @@ -1309,7 +1309,7 @@ void DELTA_SkipDescription(char **pstream) *pstream = COM_Parse(*pstream); 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, "}")); } @@ -1363,13 +1363,13 @@ qboolean DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream) if (!ppdesc) { - Sys_Error(__FUNCTION__ " with no delta_description_t\n"); + Sys_Error("%s: called with no delta_description_t\n", __func__); } *ppdesc = 0; if (!pstream) { - Sys_Error(__FUNCTION__ " with no data stream\n"); + Sys_Error("%s: called with no data stream\n", __func__); } while (true) @@ -1389,14 +1389,14 @@ qboolean DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream) pdefinition = DELTA_FindDefinition(com_token, &count); 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 pstream = COM_Parse(pstream); 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")) { @@ -1407,7 +1407,7 @@ qboolean DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream) pstream = COM_Parse(pstream); 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); @@ -1428,7 +1428,7 @@ qboolean DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream) } 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; } 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); 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); diff --git a/rehlds/engine/delta_jit.cpp b/rehlds/engine/delta_jit.cpp index 2abc59d..658d790 100644 --- a/rehlds/engine/delta_jit.cpp +++ b/rehlds/engine/delta_jit.cpp @@ -30,7 +30,7 @@ unsigned int DELTAJIT_GetFieldSize(delta_description_t* desc) { return 0; default: - Sys_Error(__FUNCTION__ ": Unknown delta field type %d", desc->fieldType); + Sys_Error("%s: Unknown delta field type %d", __func__, desc->fieldType); return 0; } } @@ -56,11 +56,11 @@ void DELTAJIT_CreateDescription(delta_t* delta, deltajitdata_t &jitdesc) { // sanity checks & pre-clean 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) { - 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)); @@ -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) { - CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__FUNCTION__, pFields); + CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__func__, pFields); CDeltaClearMarkFieldsJIT &func = *deltaJit->cleanMarkCheckFunc; return func(from, to, deltaJit, pForceMarkMask); } 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; return func(from, to, deltaJit); } 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[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) { - CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__FUNCTION__, pFields); + CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__func__, pFields); deltaJit->marked_fields_mask.u32[fieldNumber >> 5] |= (1 << (fieldNumber & 31)); } 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)); } 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)); } uint64 DELTAJit_GetOriginalMask(delta_t* pFields) { - CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__FUNCTION__, pFields); + CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__func__, pFields); return deltaJit->originalMarkedFieldsMask.u64; } uint64 DELTAJit_GetMaskU64(delta_t* pFields) { - CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__FUNCTION__, pFields); + CDeltaJit* deltaJit = DELTAJit_LookupDeltaJit(__func__, pFields); return deltaJit->marked_fields_mask.u64; } diff --git a/rehlds/engine/ed_strpool.cpp b/rehlds/engine/ed_strpool.cpp index 992bc3d..8a2e76f 100644 --- a/rehlds/engine/ed_strpool.cpp +++ b/rehlds/engine/ed_strpool.cpp @@ -40,7 +40,7 @@ char* Ed_StrPool_Alloc(const char* origStr) { unsigned int len = Q_strlen(origStr) + 1; 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); diff --git a/rehlds/engine/hashpak.cpp b/rehlds/engine/hashpak.cpp index d78e742..c28e415 100644 --- a/rehlds/engine/hashpak.cpp +++ b/rehlds/engine/hashpak.cpp @@ -72,7 +72,7 @@ qboolean HPAK_GetDataPointer(char *pakname, struct resource_s *pResource, unsign { pbuf = (byte *)Mem_Malloc(p->datasize); 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); *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)); 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)); 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->data = Mem_Malloc(pResource->nDownloadSize); 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) { @@ -192,7 +192,7 @@ void HPAK_AddToQueue(char *pakname, struct resource_s *pResource, void *pData, F else { 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); n->next = gp_hpak_queue; gp_hpak_queue = n; @@ -422,7 +422,7 @@ void HPAK_RemoveLump(char *pakname, resource_t *pResource) if (pakname == NULL || *pakname == '\0' || pResource == NULL) { - Con_Printf(__FUNCTION__ ": Invalid arguments\n"); + Con_Printf("%s: Invalid arguments\n", __func__); return; } HPAK_FlushHostQueue(); diff --git a/rehlds/engine/host.cpp b/rehlds/engine/host.cpp index 7aea1e0..96b9394 100644 --- a/rehlds/engine/host.cpp +++ b/rehlds/engine/host.cpp @@ -105,7 +105,7 @@ NOXREF void Host_EndGame(const char *message, ...) Q_vsnprintf(string, sizeof(string), message, argptr); va_end(argptr); - Con_DPrintf(__FUNCTION__ ": %s\n", string); + Con_DPrintf("%s: %s\n", __func__, string); oldn = g_pcls.demonum; @@ -116,7 +116,7 @@ NOXREF void Host_EndGame(const char *message, ...) if (!g_pcls.state) { - Sys_Error(__FUNCTION__ ": %s\n", string); + Sys_Error("%s: %s\n", __func__, string); } if (oldn != -1) @@ -142,7 +142,7 @@ void NORETURN Host_Error(const char *error, ...) va_start(argptr, error); if (inerror) - Sys_Error(__FUNCTION__ ": recursively entered"); + Sys_Error("%s: recursively entered", __func__); inerror = TRUE; SCR_EndLoadingPlaque(); @@ -152,7 +152,7 @@ void NORETURN Host_Error(const char *error, ...) if (g_psv.active && developer.value != 0.0 ) CL_WriteMessageHistory(0, 0); - Con_Printf(__FUNCTION__ ": %s\n", string); + Con_Printf("%s: %s\n", __func__, string); if (g_psv.active) Host_ShutdownServer(FALSE); @@ -163,7 +163,7 @@ void NORETURN Host_Error(const char *error, ...) inerror = FALSE; longjmp(host_abortserver, 1); } - Sys_Error(__FUNCTION__ ": %s\n", string); + Sys_Error("%s: %s\n", __func__, string); } void Host_InitLocal(void) @@ -1161,11 +1161,11 @@ int Host_Init(quakeparms_t *parms) Q_memset(&g_module, 0, sizeof(g_module)); 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"); 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"); for (int i = 0; i < 256; i++) diff --git a/rehlds/engine/host_cmd.cpp b/rehlds/engine/host_cmd.cpp index c12a837..c79c33f 100644 --- a/rehlds/engine/host_cmd.cpp +++ b/rehlds/engine/host_cmd.cpp @@ -1715,7 +1715,7 @@ void EntityInit(edict_t *pEdict, int className) { ENTITYINIT pEntityInit; if (!className) - Sys_Error("Bad class!!\n"); + Sys_Error("%s: Bad class!!\n", __func__); ReleaseEntityDLLFields(pEdict); InitEntityDLLFields(pEdict); @@ -1935,7 +1935,7 @@ int LoadGamestate(char *level, int createPlayers) else { 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; if (createPlayers && pent) @@ -2048,7 +2048,7 @@ int CreateEntityList(SAVERESTOREDATA *pSaveData, int levelMask) if (pent && !pent->free) { 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) EntityInit(pent, pEntInfo->classname); @@ -2339,7 +2339,7 @@ void Host_Changelevel2_f(void) FS_LogLevelLoadStarted(level); 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) SaveExit(pSaveData); diff --git a/rehlds/engine/mathlib.cpp b/rehlds/engine/mathlib.cpp index 7d3ef8c..efbd2fb 100644 --- a/rehlds/engine/mathlib.cpp +++ b/rehlds/engine/mathlib.cpp @@ -39,7 +39,7 @@ vec3_t vec3_origin; // aligned vec4_t typedef ALIGN16 vec4_t avec4_t; -typedef ALIGN16 int aivec4_t[4]; +typedef ALIGN16 unsigned int aivec4_t[4]; // conversion multiplier const avec4_t deg2rad = @@ -116,7 +116,7 @@ float anglemod(float a) void BOPS_Error(void) { - Sys_Error("BoxOnPlaneSide: Bad signbits"); + Sys_Error("%s: Bad signbits", __func__); } #ifdef REHLDS_OPT_PEDANTIC diff --git a/rehlds/engine/model.cpp b/rehlds/engine/model.cpp index 0147469..21713b1 100644 --- a/rehlds/engine/model.cpp +++ b/rehlds/engine/model.cpp @@ -68,14 +68,14 @@ void* EXT_FUNC Mod_Extradata(model_t *mod) 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); if (mod->cache.data == NULL) { - Sys_Error(__FUNCTION__ ": caching failed"); + Sys_Error("%s: caching failed", __func__); } return mod->cache.data; @@ -88,7 +88,7 @@ mleaf_t *Mod_PointInLeaf(vec_t *p, model_t *model) mplane_t *plane; if (!model || !model->nodes) - Sys_Error(__FUNCTION__ ": bad model"); + Sys_Error("%s: bad model", __func__); node = model->nodes; while (node->contents >= 0) @@ -140,7 +140,7 @@ model_t *Mod_FindName(qboolean trackCRC, const char *name) avail = NULL; 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++) { @@ -164,7 +164,7 @@ model_t *Mod_FindName(qboolean trackCRC, const char *name) else { if (!avail) - Sys_Error("mod_numknown >= MAX_KNOWN_MODELS"); + Sys_Error("%s: mod_numknown >= MAX_KNOWN_MODELS", __func__); mod = avail; Mod_FillInCRCInfo(trackCRC, avail - mod_known); } @@ -286,7 +286,7 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean trackCRC) if (!buf) { if (crash) - Sys_Error("Mod_NumForName: %s not found", mod->name); + Sys_Error("%s: %s not found", __func__, mod->name); return 0; } @@ -303,7 +303,7 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean trackCRC) { 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 @@ -495,7 +495,7 @@ void Mod_LoadTextures(lump_t *l) mt->width = LittleLong(mt->width); mt->height = LittleLong(mt->height); 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; 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 < 'A' || max > 'J') - Sys_Error("Bad animating texture %s", tx); + Sys_Error("%s: Bad animating texture %s", __func__, tx); altmax = max - 'A'; max = 0; altanims[altmax] = tx; @@ -592,7 +592,7 @@ void Mod_LoadTextures(lump_t *l) if (num < '0' || num > '9') { if (num < 'A' || num > 'J') - Sys_Error("Bad animating texture %s", tx); + Sys_Error("%s: Bad animating texture %s", __func__, tx); num -= 'A'; altanims[num] = tx2; @@ -613,7 +613,7 @@ void Mod_LoadTextures(lump_t *l) { tx2 = anims[j]; 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_total = max; tx2->anim_max = j + 1; @@ -626,7 +626,7 @@ void Mod_LoadTextures(lump_t *l) { tx2 = altanims[j]; 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_total = altmax; @@ -706,7 +706,7 @@ void Mod_LoadVertexes(lump_t *l) in = (dvertex_t *)(mod_base + l->fileofs); 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); 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); 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); 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); 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); 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); 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); out = (mtexinfo_t*) Hunk_AllocName(count*sizeof(*out), loadname); @@ -829,7 +829,7 @@ void Mod_LoadTexinfo(lump_t *l) else { if (_miptex >= loadmodel->numtextures) - Sys_Error("miptex >= loadmodel->numtextures"); + Sys_Error("%s: miptex >= loadmodel->numtextures", __func__); out->texture = loadmodel->textures[_miptex]; if (!out->texture) { @@ -882,7 +882,7 @@ void CalcSurfaceExtents(msurface_t *s) s->texturemins[i] = bmins[i] * 16; s->extents[i] = (bmaxs[i] - bmins[i]) * 16; 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); 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); 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); 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); 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); 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); 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) { - Sys_Error(__FUNCTION__ ": oversized loadmodel->numleafs: %i", loadmodel->numleafs); + Sys_Error("%s: oversized loadmodel->numleafs: %i", __func__, loadmodel->numleafs); } } #endif @@ -1080,7 +1080,7 @@ void Mod_LoadClipnodes(lump_t *l) in = (dclipnode_t *)(mod_base + l->fileofs); 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); 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); 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); out = (msurface_t **) Hunk_AllocName(count * sizeof(*out), loadname); @@ -1182,7 +1182,7 @@ void Mod_LoadMarksurfaces(lump_t *l) { j = LittleShort(in[i]); if (j >= loadmodel->numsurfaces) - Sys_Error("Mod_ParseMarksurfaces: bad surface number"); + Sys_Error("%s: bad surface number", __func__); out[i] = loadmodel->surfaces + j; } } @@ -1194,7 +1194,7 @@ void Mod_LoadSurfedges(lump_t *l) in = (int *)(mod_base + l->fileofs); 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); 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); 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); 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); 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 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); if (*poutintervals <= 0.0f) - Sys_Error(__FUNCTION__ ": interval<=0"); + Sys_Error("%s: interval<=0", __func__); poutintervals++; pin_intervals++; @@ -1443,7 +1443,7 @@ void *Mod_LoadAliasSkin(void *pin, int *pskinindex, int skinsize, aliashdr_t *ph if (r_pixbytes == 1) Q_memcpy(pskin, pinskin, skinsize); 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]; } @@ -1473,7 +1473,7 @@ void *Mod_LoadAliasSkinGroup(void *pin, int *pskinindex, int skinsize, aliashdr_ *poutskinintervals = LittleFloat(pinskinintervals->interval); if (*poutskinintervals <= 0.0f) - Sys_Error(__FUNCTION__ ": interval<=0"); + Sys_Error("%s: interval<=0", __func__); poutskinintervals++; pinskinintervals++; @@ -1514,7 +1514,7 @@ void Mod_LoadAliasModel(model_t *mod, void *buffer) version = LittleLong(pinmodel->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, // skin and group info @@ -1534,20 +1534,20 @@ void Mod_LoadAliasModel(model_t *mod, void *buffer) pmodel->skinheight = LittleLong(pinmodel->skinheight); 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); 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) - 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); 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->size = LittleFloat(pinmodel->size) * 0.09090909090909091; @@ -1566,7 +1566,7 @@ void Mod_LoadAliasModel(model_t *mod, void *buffer) numframes = pmodel->numframes; 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; @@ -1574,7 +1574,7 @@ void Mod_LoadAliasModel(model_t *mod, void *buffer) skinsize = pmodel->skinwidth * pmodel->skinheight; 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); 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 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); for (i = 0; i < numframes; i++) @@ -1715,7 +1715,7 @@ void *Mod_LoadSpriteFrame(void *pin, mspriteframe_t **ppframe) } 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); @@ -1749,7 +1749,7 @@ void *Mod_LoadSpriteGroup(void *pin, mspriteframe_t **ppframe) { *poutintervals = LittleFloat(pin_intervals->interval); if (*poutintervals <= 0.0f) - Sys_Error(__FUNCTION__ ": interval<=0"); + Sys_Error("%s: interval<=0", __func__); poutintervals++; pin_intervals++; @@ -1779,8 +1779,7 @@ void Mod_LoadSpriteModel(model_t *mod, void *buffer) version = LittleLong(pin->version); if (version != SPRITE_VERSION) - Sys_Error("%s has wrong version number " - "(%i should be %i)", mod->name, version, SPRITE_VERSION); + Sys_Error("%s: %s has wrong version number (%i should be %i)", __func__, mod->name, version, SPRITE_VERSION); numframes = LittleLong(pin->numframes); int palsize = *(uint16*)&pin[1]; @@ -1817,7 +1816,7 @@ void Mod_LoadSpriteModel(model_t *mod, void *buffer) // load the frames // 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->flags = 0; @@ -1916,7 +1915,7 @@ model_t *Mod_Handle(int modelindex) { #ifdef REHLDS_FIXES 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 diff --git a/rehlds/engine/net_chan.cpp b/rehlds/engine/net_chan.cpp index 08c16bb..09f190f 100644 --- a/rehlds/engine/net_chan.cpp +++ b/rehlds/engine/net_chan.cpp @@ -62,7 +62,7 @@ void Netchan_UnlinkFragment(fragbuf_t *buf, fragbuf_t **list) 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; } @@ -85,7 +85,7 @@ void Netchan_UnlinkFragment(fragbuf_t *buf, fragbuf_t **list) 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) @@ -167,7 +167,7 @@ void Netchan_Clear(netchan_t *chan) 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_length = 0; } @@ -1157,7 +1157,7 @@ void Netchan_CreateFileFragmentsFromBuffer(qboolean server, netchan_t *chan, con if (server) SV_DropClient(host_client, 0, "Malloc problem"); else - rehlds_syserror(__FUNCTION__ "Reverse me: client-side code"); + rehlds_syserror("%s:Reverse me: client-side code", __func__); #ifdef REHLDS_FIXES if (bCompressed) { @@ -1357,7 +1357,7 @@ int Netchan_CreateFileFragments_(qboolean server, netchan_t *chan, const char *f } else { - rehlds_syserror(__FUNCTION__ ": Reverse clientside code"); + rehlds_syserror("%s: Reverse clientside code", __func__); return 0; } } diff --git a/rehlds/engine/net_ws.cpp b/rehlds/engine/net_ws.cpp index acfd4ea..7235791 100644 --- a/rehlds/engine/net_ws.cpp +++ b/rehlds/engine/net_ws.cpp @@ -589,7 +589,7 @@ void NET_TransferRawData(sizebuf_t *msg, unsigned char *pStart, int nSize) #ifdef REHLDS_CHECKS 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 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 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 @@ -1000,14 +1000,15 @@ qboolean NET_QueuePacket(netsrc_t sock) { if (err == WSAEMSGSIZE) { - Con_DPrintf("NET_QueuePacket: Ignoring oversized network message\n"); + Con_DPrintf("%s: Ignoring oversized network message\n", __func__); } else { if (g_pcls.state != ca_dedicated) - Sys_Error("NET_QueuePacket: %s", NET_ErrorString(err)); - else - Con_Printf("NET_QueuePacket: %s\n", NET_ErrorString(err)); + { + Sys_Error("%s: %s", __func__, NET_ErrorString(err)); + } + Con_Printf("%s: %s\n", __func__, NET_ErrorString(err)); } } continue; @@ -1017,7 +1018,7 @@ qboolean NET_QueuePacket(netsrc_t sock) if (ret != MAX_UDP_PACKET) 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) { @@ -1173,7 +1174,7 @@ void NET_StartThread(void) if (!net_thread_initialized) { net_thread_initialized = TRUE; - Sys_Error("-net_thread is not reversed yet"); + Sys_Error("%s: -net_thread is not reversed yet", __func__); #ifdef _WIN32 /* InitializeCriticalSection(&net_cs); @@ -1183,7 +1184,7 @@ void NET_StartThread(void) DeleteCriticalSection(&net_cs); net_thread_initialized = 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 @@ -1204,7 +1205,7 @@ void NET_StopThread(void) */ #endif // _WIN32 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 else { - Sys_Error(__FUNCTION__ ": bad address type"); + Sys_Error("%s: bad address type", __func__); } 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 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 { 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 { - 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) #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; } diff --git a/rehlds/engine/pmovetst.cpp b/rehlds/engine/pmovetst.cpp index 2946767..a862877 100644 --- a/rehlds/engine/pmovetst.cpp +++ b/rehlds/engine/pmovetst.cpp @@ -113,7 +113,7 @@ int EXT_FUNC PM_HullPointContents(hull_t *hull, int num, vec_t *p) while (num >= 0) { 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]; plane = &hull->planes[node->planenum]; diff --git a/rehlds/engine/pr_cmds.cpp b/rehlds/engine/pr_cmds.cpp index 1ccbc39..ba88336 100644 --- a/rehlds/engine/pr_cmds.cpp +++ b/rehlds/engine/pr_cmds.cpp @@ -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++) { if (min[i] > max[i]) - Host_Error("backwards mins/maxs"); + Host_Error("%s: backwards mins/maxs", __func__); } 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) @@ -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) { 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) - Sys_Error("EMIT_SOUND: attenuation = %f", attenuation); + Sys_Error("%s: attenuation = %f", __func__, attenuation); if (channel < 0 || channel > 7) - Sys_Error("EMIT_SOUND: channel = %i", channel); + Sys_Error("%s: channel = %i", __func__, channel); 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); } @@ -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) { - 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) @@ -906,7 +906,7 @@ edict_t* EXT_FUNC CreateNamedEntity(int className) ENTITYINIT pEntityInit; if (!className) - Sys_Error("Spawned a NULL entity!"); + Sys_Error("%s: Spawned a NULL entity!", __func__); pedict = ED_Alloc(); pedict->v.classname = className; @@ -1020,13 +1020,13 @@ int EXT_FUNC PF_precache_sound_I(const char *s) int i; if (!s) - Host_Error(__FUNCTION__ ": NULL pointer"); + Host_Error("%s: NULL pointer", __func__); if (PR_IsEmptyString(s)) - Host_Error(__FUNCTION__ ": Bad string '%s'", s); + Host_Error("%s: Bad string '%s'", __func__, s); 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) { @@ -1049,8 +1049,8 @@ int EXT_FUNC PF_precache_sound_I(const char *s) return i; } - Host_Error(__FUNCTION__ ": 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.", + 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.", __func__, s, MAX_SOUNDS); } else @@ -1062,7 +1062,7 @@ int EXT_FUNC PF_precache_sound_I(const char *s) 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 @@ -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) { if (!psz) - Host_Error(__FUNCTION__ ": NULL pointer"); + Host_Error("%s: NULL pointer", __func__); 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) { @@ -1085,7 +1085,7 @@ unsigned short EXT_FUNC EV_Precache(int type, const char *psz) if (!ev->filename) { 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]; 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; char* evScript = (char*) COM_LoadFile(szpath, 5, &scriptSize); 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 // 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. @@ -1114,7 +1114,7 @@ unsigned short EXT_FUNC EV_Precache(int type, const char *psz) if (!Q_stricmp(ev->filename, psz)) return i; } - Host_Error(__FUNCTION__ ": '%s' overflow", psz); + Host_Error("%s: '%s' overflow", __func__, psz); } else { @@ -1125,7 +1125,7 @@ unsigned short EXT_FUNC EV_Precache(int type, const char *psz) 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) { - Con_DPrintf(__FUNCTION__ ": index out of range %i\n", eventindex); + Con_DPrintf("%s: index out of range %i\n", __func__, eventindex); return; } 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; } @@ -1355,7 +1355,7 @@ void EXT_FUNC EV_SV_Playback(int flags, int clientindex, unsigned short eventind return; 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; 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; if (!s) - Host_Error(__FUNCTION__ ": NULL pointer"); + Host_Error("%s: NULL pointer", __func__); if (PR_IsEmptyString(s)) - Host_Error(__FUNCTION__ ": Bad string '%s'", s); + Host_Error("%s: Bad string '%s'", __func__, s); if (*s == '!') { @@ -1435,8 +1435,8 @@ int EXT_FUNC PF_precache_model_I(const char *s) return i; #endif } - Host_Error(__FUNCTION__ ": 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.", + 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.", __func__, s, MAX_MODELS); } else @@ -1452,7 +1452,7 @@ int EXT_FUNC PF_precache_model_I(const char *s) return i; #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) { if (!s) - Host_Error(__FUNCTION__ ": NULL pointer"); + Host_Error("%s: NULL pointer", __func__); if (PR_IsEmptyString(s)) { // 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]; @@ -1490,12 +1490,12 @@ int EXT_FUNC PF_precache_generic_I(char *s) } 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)) { - Host_Error(__FUNCTION__ ": 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.", + 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.", __func__, 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) { if (!s) - Host_Error(__FUNCTION__ ": NULL pointer"); + Host_Error("%s: NULL pointer", __func__); if (PR_IsEmptyString(s)) { // 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) @@ -1528,8 +1528,8 @@ int EXT_FUNC PF_precache_generic_I(char *s) if (!Q_stricmp(g_psv.generic_precache[i], s)) return i; } - Host_Error(__FUNCTION__ ": 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.", + 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.", __func__, s, MAX_GENERIC); } else @@ -1539,7 +1539,7 @@ int EXT_FUNC PF_precache_generic_I(char *s) if (!Q_stricmp(g_psv.generic_precache[i], s)) 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 @@ -1614,7 +1614,7 @@ void EXT_FUNC PF_SetKeyValue_I(char *infobuffer, const char *key, const char *va { 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 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); 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]; if (!client->fakeclient) @@ -2049,7 +2049,7 @@ sizebuf_t* EXT_FUNC WriteDest_Parm(int dest) entnum = NUM_FOR_EDICT(gMsgEntity); 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) { @@ -2069,7 +2069,7 @@ sizebuf_t* EXT_FUNC WriteDest_Parm(int dest) case MSG_SPEC: return &g_psv.spectator; 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 (!ed) - Sys_Error("MSG_ONE or MSG_ONE_UNRELIABLE with no target entity\n"); + Sys_Error("%s: with no target entity\n", __func__); } else { 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) - 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) - 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; gMsgType = msg_type; @@ -2117,14 +2117,14 @@ void EXT_FUNC PF_MessageEnd_I(void) { qboolean MsgIsVarLength = 0; if (!gMsgStarted) - Sys_Error("MESSAGE_END called with no active message\n"); + Sys_Error("%s: called with no active message\n", __func__); gMsgStarted = 0; if (gMsgEntity && (gMsgEntity->v.flags & FL_FAKECLIENT)) return; 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) @@ -2142,7 +2142,7 @@ void EXT_FUNC PF_MessageEnd_I(void) if (!pUserMsg) { - Con_DPrintf("PF_MessageEnd_I: Unknown User Msg %d\n", gMsgType); + Con_DPrintf("%s: Unknown User Msg %d\n", __func__, gMsgType); return; } @@ -2152,22 +2152,12 @@ void EXT_FUNC PF_MessageEnd_I(void) // Limit packet sizes if (gMsgBuffer.cursize > MAX_USER_MSG_DATA) - Host_Error( - "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 - ); + 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); } else { if (pUserMsg->iSize != gMsgBuffer.cursize) - Sys_Error( - "User Msg '%s': %d bytes written, expected %d\n", - pUserMsg->szName, - gMsgBuffer.cursize, - pUserMsg->iSize - ); + Sys_Error("%s: User Msg '%s': %d bytes written, expected %d\n", __func__, pUserMsg->szName, gMsgBuffer.cursize, pUserMsg->iSize); } } #ifdef REHLDS_FIXES @@ -2182,7 +2172,7 @@ void EXT_FUNC PF_MessageEnd_I(void) { int entnum = NUM_FOR_EDICT((const edict_t *)gMsgEntity); 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]; if (client->fakeclient || !client->hasusrmsgs || (!client->active && !client->spawned)) @@ -2197,9 +2187,11 @@ void EXT_FUNC PF_MessageEnd_I(void) #ifdef REHLDS_FIXES ; - if (gMsgDest == MSG_ALL) { + if (gMsgDest == MSG_ALL) + { 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; if (gMsgEntity == nullptr) continue; @@ -2207,7 +2199,9 @@ void EXT_FUNC PF_MessageEnd_I(void) continue; writer(); } - } else { + } + else + { writer(); } #endif @@ -2238,56 +2232,56 @@ void EXT_FUNC PF_MessageEnd_I(void) void EXT_FUNC PF_WriteByte_I(int iValue) { 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); } void EXT_FUNC PF_WriteChar_I(int iValue) { 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); } void EXT_FUNC PF_WriteShort_I(int iValue) { 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); } void EXT_FUNC PF_WriteLong_I(int iValue) { 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); } void EXT_FUNC PF_WriteAngle_I(float flValue) { 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); } void EXT_FUNC PF_WriteCoord_I(float flValue) { 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)); } void EXT_FUNC PF_WriteString_I(const char *sz) { 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); } void EXT_FUNC PF_WriteEntity_I(int iValue) { 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); } @@ -2337,7 +2331,7 @@ void EXT_FUNC PF_setspawnparms_I(edict_t *ent) { int i = NUM_FOR_EDICT(ent); 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) @@ -2652,10 +2646,10 @@ void EXT_FUNC PF_ForceUnmodified(FORCE_TYPE type, float *mins, float *maxs, cons int i; if (!filename) - Host_Error(__FUNCTION__ ": NULL pointer"); + Host_Error("%s: NULL pointer", __func__); 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) { @@ -2670,7 +2664,7 @@ void EXT_FUNC PF_ForceUnmodified(FORCE_TYPE type, float *mins, float *maxs, cons ++i; if (i >= 512) - Host_Error(__FUNCTION__ ": '%s' overflow", filename); + Host_Error("%s: '%s' overflow", __func__, filename); } cnode->check_type = type; @@ -2697,7 +2691,7 @@ void EXT_FUNC PF_ForceUnmodified(FORCE_TYPE type, float *mins, float *maxs, cons ++cnode; ++i; 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); } } } diff --git a/rehlds/engine/pr_edict.cpp b/rehlds/engine/pr_edict.cpp index ecdb25c..45c0c9c 100644 --- a/rehlds/engine/pr_edict.cpp +++ b/rehlds/engine/pr_edict.cpp @@ -57,9 +57,9 @@ edict_t *ED_Alloc(void) { 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 @@ -221,7 +221,7 @@ char *ED_ParseEdict(char *data, edict_t *ent) } 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); @@ -235,11 +235,11 @@ char *ED_ParseEdict(char *data, edict_t *ent) data = COM_Parse(data); if (!data) { - Host_Error(__FUNCTION__ ": EOF without closing brace"); + Host_Error("%s: EOF without closing brace", __func__); } 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)) @@ -300,7 +300,7 @@ void ED_LoadFromFile(char *data) } 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) @@ -353,7 +353,7 @@ edict_t *EDICT_NUM(int n) { 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]; } @@ -365,7 +365,7 @@ int NUM_FOR_EDICT(const edict_t *e) if (b < 0 || b >= g_psv.num_edicts) { - Sys_Error(__FUNCTION__ ": bad pointer"); + Sys_Error("%s: bad pointer", __func__); } return b; @@ -397,7 +397,7 @@ bool SuckOutClassname(char *szInputStream, edict_t *pEdict) if (kvd.fHandled == FALSE) { - Host_Error(__FUNCTION__ ": parse error"); + Host_Error("%s: parse error", __func__); } return true; @@ -424,7 +424,7 @@ bool SuckOutClassname(char *szInputStream, edict_t *pEdict) if (kvd.fHandled == FALSE) { - Host_Error(__FUNCTION__ ": parse error"); + Host_Error("%s: parse error", __func__); } return true; @@ -525,7 +525,7 @@ int EXT_FUNC IndexOfEdict(const edict_t *pEdict) if (index < 0 || index > g_psv.max_edicts) #endif // REHLDS_FIXES { - Sys_Error(__FUNCTION__ ": bad entity"); + Sys_Error("%s: bad entity", __func__); } } return index; @@ -625,7 +625,7 @@ void EXT_FUNC SaveSpawnParms(edict_t *pEdict) int eoffset = NUM_FOR_EDICT(pEdict); 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 } diff --git a/rehlds/engine/r_studio.cpp b/rehlds/engine/r_studio.cpp index c7255b2..db5c48d 100644 --- a/rehlds/engine/r_studio.cpp +++ b/rehlds/engine/r_studio.cpp @@ -628,7 +628,7 @@ hull_t *R_StudioHull(model_t *pModel, float frame, int sequence, const vec_t *an if (r_cachestudio.value != 0) { #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 // 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) { #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 // TODO: Reverse for client-side // R_AddToStudioCache(float frame, diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 958f8f8..1bfe7fe 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -327,7 +327,7 @@ delta_t *SV_LookupDelta(char *name) 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; } @@ -423,7 +423,7 @@ void SV_ReallocateDynamicData(void) { if (!g_psv.max_edicts) { - Con_DPrintf(__FUNCTION__ " with sv.max_edicts == 0\n"); + Con_DPrintf("%s: sv.max_edicts == 0\n", __func__); return; } @@ -470,6 +470,7 @@ qboolean SV_IsPlayerIndex(int index) return (index >= 1 && index <= g_psvs.maxclients); } +#ifdef _WIN32 qboolean __declspec(naked) SV_IsPlayerIndex_wrapped(int index) { // 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; } } +#else // _WIN32 +qboolean SV_IsPlayerIndex_wrapped(int index) +{ + return SV_IsPlayerIndex(index); +} +#endif // _WIN32 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) { - Con_Printf(__FUNCTION__ ": volume = %i", volume); + Con_Printf("%s: volume = %i", __func__, volume); volume = (volume < 0) ? 0 : 255; } 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; } 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; } if (pitch < 0 || pitch > 255) { - Con_Printf(__FUNCTION__ ": pitch = %i", pitch); + Con_Printf("%s: pitch = %i", __func__, pitch); 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); 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; } } @@ -818,7 +825,7 @@ qboolean SV_BuildSoundMsg(edict_t *entity, int channel, const char *sample, int sound_num = SV_LookupSoundIndex(sample); 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; } } @@ -927,7 +934,7 @@ void SV_AddSampleToHashedLookupTable(const char *pszSample, int iSampleIndex) index = 0; 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; @@ -1848,7 +1855,7 @@ int EXT_FUNC SV_CheckProtocol_internal(netadr_t *adr, int nProtocol) { if (adr == NULL) { - Sys_Error(__FUNCTION__ ": Null address\n"); + Sys_Error("%s: Null address\n", __func__); } 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) { if (!adr) - Sys_Error(__FUNCTION__ ": Null address\n"); + Sys_Error("%s: Null address\n", __func__); if (NET_IsLocalAddress(*adr)) return 1; @@ -2646,19 +2653,19 @@ void SV_ResetModInfo(void) nFileSize = FS_Size(hLibListFile); 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); 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); 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; @@ -5055,7 +5062,7 @@ int SV_ModelIndex(const char *name) }; #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) @@ -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) #endif // REHLDS_FIXES { - Sys_Error("Too many resources on server."); + Sys_Error("%s: Too many resources on server.", __func__); } #ifdef REHLDS_FIXES @@ -5426,38 +5433,6 @@ void EXT_FUNC SV_WriteVoiceCodec_internal(sizebuf_t *pBuf) 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) { edict_t *svent; @@ -5487,7 +5462,35 @@ void SV_CreateBaseline(void) else 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; } } @@ -5547,7 +5550,7 @@ void SV_BroadcastCommand(char *fmt, ...) MSG_WriteByte(&msg, svc_stufftext); MSG_WriteString(&msg, string); 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) { @@ -6472,7 +6475,7 @@ void SV_BanId_f(void) } 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; } } @@ -6501,7 +6504,7 @@ void SV_BanId_f(void) 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 { kick }\n"); Con_Printf("Use 0 minutes for permanent\n"); return; @@ -6519,7 +6522,7 @@ void SV_BanId_f(void) { if (numuserfilters >= MAX_USERFILTERS) { - Con_Printf(__FUNCTION__ ": User filter list is full\n"); + Con_Printf("%s: User filter list is full\n", __func__); return; } numuserfilters++; @@ -6806,7 +6809,7 @@ void SV_RemoveId_f(void) if (!idstring[0]) { - Con_Printf(__FUNCTION__ ": Id string is empty!\n"); + Con_Printf("%s: Id string is empty!\n", __func__); return; } @@ -6815,7 +6818,7 @@ void SV_RemoveId_f(void) int slot = Q_atoi(&idstring[1]); if (slot <= 0 || slot > numuserfilters) { - Con_Printf(__FUNCTION__ ": invalid slot #%i\n", slot); + Con_Printf("%s: invalid slot #%i\n", __func__, slot); return; } slot--; @@ -7659,7 +7662,7 @@ void SV_RegisterDelta(char *name, char *loadfile) { delta_t *pdesc = NULL; 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)); p->loadfile = Mem_Strdup(loadfile); @@ -7686,32 +7689,32 @@ void SV_InitDeltas(void) g_pplayerdelta = SV_LookupDelta("entity_state_player_t"); 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"); 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"); 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"); 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"); 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"); 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 g_pusercmddelta = SV_LookupDelta("usercmd_t"); if (!g_pusercmddelta) - Sys_Error("No usercmd_t encoder on server!\n"); + Sys_Error("%s: No usercmd_t encoder on server!\n", __func__); #endif #if defined(REHLDS_OPT_PEDANTIC) || defined(REHLDS_FIXES) diff --git a/rehlds/engine/sv_move.h b/rehlds/engine/sv_move.h index a244ca1..e510c35 100644 --- a/rehlds/engine/sv_move.h +++ b/rehlds/engine/sv_move.h @@ -42,11 +42,11 @@ #define c_yes (*pc_yes) #define c_no (*pc_no) -#endif // HOOK_ENGINE - extern int c_yes; extern int c_no; +#endif // HOOK_ENGINE + qboolean SV_CheckBottom(edict_t *ent); qboolean SV_movetest(edict_t *ent, vec_t *move, qboolean relink); qboolean SV_movestep(edict_t *ent, vec_t *move, qboolean relink); diff --git a/rehlds/engine/sv_phys.cpp b/rehlds/engine/sv_phys.cpp index 3382f7f..510e252 100644 --- a/rehlds/engine/sv_phys.cpp +++ b/rehlds/engine/sv_phys.cpp @@ -255,7 +255,7 @@ int SV_FlyMove(edict_t *ent, float time, trace_t *steptrace) break; if (!trace.ent) - Sys_Error("SV_FlyMove: !trace.ent"); + Sys_Error("%s: !trace.ent", __func__); if (trace.plane.normal[2] > 0.7) { @@ -621,7 +621,7 @@ int SV_PushRotate(edict_t *pusher, float movetime) ++num_moved; 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; @@ -1392,7 +1392,7 @@ void SV_Physics(void) break; 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) diff --git a/rehlds/engine/sv_steam3.cpp b/rehlds/engine/sv_steam3.cpp index 67bd739..708fca8 100644 --- a/rehlds/engine/sv_steam3.cpp +++ b/rehlds/engine/sv_steam3.cpp @@ -672,7 +672,7 @@ qboolean Steam_NotifyClientConnect_internal(client_t *cl, const void *pvSteam2Ke { return Steam3Server()->NotifyClientConnect(cl, pvSteam2Key, ucbSteam2Key); } - return NULL; + return FALSE; } qboolean EXT_FUNC Steam_NotifyBotConnect_api(IGameClient* cl) @@ -691,7 +691,7 @@ qboolean Steam_NotifyBotConnect_internal(client_t *cl) { return Steam3Server()->NotifyBotConnect(cl); } - return NULL; + return FALSE; } void EXT_FUNC Steam_NotifyClientDisconnect_api(IGameClient* cl) diff --git a/rehlds/engine/sv_upld.cpp b/rehlds/engine/sv_upld.cpp index 351e615..63a266e 100644 --- a/rehlds/engine/sv_upld.cpp +++ b/rehlds/engine/sv_upld.cpp @@ -90,7 +90,7 @@ void SV_ClearResourceLists(client_t *cl) { if (!cl) { - Sys_Error("SV_ClearResourceLists with NULL client!"); + Sys_Error("%s: SV_ClearResourceLists with NULL client!", __func__); } SV_ClearResourceList(&cl->resourcesneeded); @@ -165,7 +165,7 @@ void SV_Customization(client_t *pPlayer, resource_t *pResource, qboolean bSkipPl } 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; diff --git a/rehlds/engine/sv_user.cpp b/rehlds/engine/sv_user.cpp index cd6ca39..0278628 100644 --- a/rehlds/engine/sv_user.cpp +++ b/rehlds/engine/sv_user.cpp @@ -315,7 +315,7 @@ int EXT_FUNC SV_TransferConsistencyInfo_internal(void) vec3_t 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[13], maxs, sizeof(maxs)); diff --git a/rehlds/engine/sys_dll.cpp b/rehlds/engine/sys_dll.cpp index 29a7c47..5d4fc01 100644 --- a/rehlds/engine/sys_dll.cpp +++ b/rehlds/engine/sys_dll.cpp @@ -263,7 +263,7 @@ void __cdecl Sys_InitHardwareTimer() Sys_InitFPUControlWords(); if (!CRehldsPlatformHolder::get()->QueryPerfFreq(&perfFreq)) - Sys_Error("No hardware timer available"); + Sys_Error("%s: No hardware timer available", __func__); perfHighPart = perfFreq.HighPart; perfLowPart = perfFreq.LowPart; @@ -308,7 +308,7 @@ const char *Sys_FindFirst(const char *path, char *basename) { 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); @@ -333,7 +333,10 @@ const char *Sys_FindFirstPathID(const char *path, char *pathid) { //const char *psz;//unused? if (g_hfind != -1) - Sys_Error("Sys_FindFirst without close"); + { + Sys_Error("%s: called without close", __func__); + } + return FS_FindFirst(path, &g_hfind, pathid); } @@ -403,7 +406,7 @@ NOXREF void Sys_MakeCodeWriteable(uint32 startaddr, uint32 length) NOXREFCHECK; #ifdef _WIN32 if (!VirtualProtect((LPVOID)startaddr, length, PAGE_EXECUTE_READWRITE, (PDWORD)&length)) - Sys_Error("Protection change failed."); + Sys_Error("%s: Protection change failed.", __func__); #endif // _WIN32 } @@ -505,9 +508,10 @@ void NORETURN Sys_Error(const char *error, ...) } #endif // SWDS - //exit(-1); //Allahu akbar! - *(int *)NULL = NULL; + int *null = 0; + *null = 0; + exit(-1); } NOXREF void Sys_Warning(const char *pszWarning, ...) @@ -901,15 +905,15 @@ void LoadEntityDLLs(const char *szBaseDir) nFileSize = FS_Size(hLibListFile); nFileSize2 = nFileSize; 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); 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); 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; pStreamPos = pszInputStream; diff --git a/rehlds/engine/sys_dll.h b/rehlds/engine/sys_dll.h index 3df8e6e..ca009ae 100644 --- a/rehlds/engine/sys_dll.h +++ b/rehlds/engine/sys_dll.h @@ -42,17 +42,12 @@ #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 -#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 -#define NOXREFCHECK const char* noxref_msg = "[NOXREFCHECK]:" __FUNCTION__ " (" __FILE__ ":"__LINE__AS_STRING") NOXREF, but called from 0x%.08x"; \ - asm volatile ( \ - "pushl 4(%%ebp)\n\t" \ - "pushl %0\n\t" \ - "call $Sys_Error\n\t" \ - "addl %%esp, $8\n\t" \ - :: \ - "m" (noxref_msg) \ - ); +// For EBP based stack (older gcc) (uncomment version apropriate for your compiler) +//#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); +// For ESP based stack (newer gcc) (uncomment version apropriate for your compiler) +#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); #endif @@ -172,7 +167,7 @@ NOBODY void MaskExceptions(void); NOBODY void Sys_Init(void); NOXREF void Sys_Sleep(int msec); 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, ...); void Sys_Printf(const char *fmt, ...); void Sys_Quit(void); diff --git a/rehlds/engine/sys_dll2.cpp b/rehlds/engine/sys_dll2.cpp index 4fd4714..df546cf 100644 --- a/rehlds/engine/sys_dll2.cpp +++ b/rehlds/engine/sys_dll2.cpp @@ -203,7 +203,7 @@ void Sys_CheckOSVersion(void) Q_memset(&verInfo, 0, sizeof(verInfo)); verInfo.dwOSVersionInfoSize = sizeof(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; if (verInfo.dwPlatformId == 1 && verInfo.dwMajorVersion == 4) @@ -348,7 +348,7 @@ void Sys_InitMemory(void) if (lpBuffer.dwTotalPhys) { 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); if (host_parms.memsize < MINIMUM_WIN_MEMORY) @@ -376,7 +376,7 @@ void Sys_InitMemory(void) #endif // _WIN32 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) @@ -693,7 +693,7 @@ bool CDedicatedServerAPI::Init_noVirt(char *basedir, char *cmdline, CreateInterf g_bIsDedicatedServer = TRUE; 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]; Q_snprintf(text, ARRAYSIZE(text), "exec %s\n", servercfgfile.string); diff --git a/rehlds/engine/sys_engine.cpp b/rehlds/engine/sys_engine.cpp index b2e31a0..3ea8922 100644 --- a/rehlds/engine/sys_engine.cpp +++ b/rehlds/engine/sys_engine.cpp @@ -88,7 +88,7 @@ void ForceReloadProfile() //SDL_GL_SetSwapInterval((gl_vsync.value <= 0.0) - 1); 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); Q_strncpy(szRate, v0, 0x20u); diff --git a/rehlds/engine/textures.cpp b/rehlds/engine/textures.cpp index 801e0fd..2f160a1 100644 --- a/rehlds/engine/textures.cpp +++ b/rehlds/engine/textures.cpp @@ -55,7 +55,7 @@ cvar_t r_wadtextures; void SafeRead(FileHandle_t f, void *buffer, int 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) @@ -122,12 +122,12 @@ qboolean TEX_InitFromWad(char *path) texfile = FS_Open(wadPath, "rb"); texfiles[nTexFiles++] = 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); SafeRead(texfile, &header, 12); 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.infotableofs = LittleLong(header.infotableofs); @@ -196,7 +196,7 @@ int FindMiptex(char *name) } if (nummiptex == 512) - Sys_Error("Exceeded MAX_MAP_TEXTURES"); + Sys_Error("%s: Exceeded MAX_MAP_TEXTURES", __func__); Q_strncpy(miptex[i], name, 63); miptex[i][63] = 0; diff --git a/rehlds/engine/tmessage.cpp b/rehlds/engine/tmessage.cpp index 118956d..0b5996f 100644 --- a/rehlds/engine/tmessage.cpp +++ b/rehlds/engine/tmessage.cpp @@ -347,7 +347,7 @@ NOXREF void TextMessageParse(unsigned char *pMemFile, int fileSize) while (memfgets(pMemFile, fileSize, &filePos, buf, 512) != NULL) { if(messageCount >= MAX_MESSAGES) - Sys_Error("tmessage::TextMessageParse : messageCount>=MAX_MESSAGES"); + Sys_Error("%s: messageCount >= MAX_MESSAGES", __func__); TrimSpace(buf, trim); switch (mode) diff --git a/rehlds/engine/wad.cpp b/rehlds/engine/wad.cpp index edf8597..409b94b 100644 --- a/rehlds/engine/wad.cpp +++ b/rehlds/engine/wad.cpp @@ -69,8 +69,8 @@ int W_LoadWadFile(char *filename) if (!wad->wad_base) { if (!slot) - Sys_Error("W_LoadWadFile: couldn't load %s", filename); - Con_Printf("WARNING: W_LoadWadFile, couldn't load %s\n", filename); + Sys_Error("%s: couldn't load %s", __func__, filename); + Con_Printf("WARNING: %s, couldn't load %s\n", __func__, filename); return -1; } @@ -79,7 +79,7 @@ int W_LoadWadFile(char *filename) wad->wadname[sizeof(wad->wadname) - 1] = 0; wad->loaded = TRUE; 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); 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) - Sys_Error("W_GetLumpinfo: %s not found", name); + Sys_Error("%s: %s not found", __func__, name); return NULL; } @@ -130,7 +130,7 @@ NOXREF void *W_GetLumpNum(int wad, int num) NOXREFCHECK; lumpinfo_t *lump; 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; return (void *)&wads[wad].wad_base[lump->filepos]; diff --git a/rehlds/engine/world.cpp b/rehlds/engine/world.cpp index e369b37..68479e2 100644 --- a/rehlds/engine/world.cpp +++ b/rehlds/engine/world.cpp @@ -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); 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]; 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.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); } @@ -602,7 +602,7 @@ int SV_HullPointContents(hull_t *hull, int num, const vec_t *p) while (i >= 0) { if (hull->firstclipnode > i || hull->lastclipnode < i) - Sys_Error(__FUNCTION__ ": bad node number"); + Sys_Error("%s: bad node number", __func__); node = &hull->clipnodes[i]; plane = &hull->planes[node->planenum]; 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 < hull->firstclipnode || num > hull->lastclipnode || !hull->planes) - Sys_Error(__FUNCTION__ ": bad node number"); + Sys_Error("%s: bad node number", __func__); node = &hull->clipnodes[num]; 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; 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]; plane = &hull->planes[hull->clipnodes[num].planenum]; @@ -1185,7 +1185,7 @@ void SV_ClipToLinks(areanode_t *node, moveclip_t *clip) continue; 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)) #ifdef REHLDS_FIXES diff --git a/rehlds/engine/zone.cpp b/rehlds/engine/zone.cpp index c01c1d0..2f67b78 100644 --- a/rehlds/engine/zone.cpp +++ b/rehlds/engine/zone.cpp @@ -98,19 +98,19 @@ void Z_Free(void *ptr) { if (!ptr) { - Sys_Error(__FUNCTION__ ": NULL pointer"); + Sys_Error("%s: NULL pointer", __func__); } memblock_t *block = (memblock_t *)((char *)ptr - sizeof(memblock_t)); if (block->id != ZONEID) { - Sys_Error(__FUNCTION__ ": freed a pointer without ZONEID"); + Sys_Error("%s: freed a pointer without ZONEID", __func__); } if (!block->tag) { - Sys_Error(__FUNCTION__ ": freed a freed pointer"); + Sys_Error("%s: freed a freed pointer", __func__); } block->tag = 0; @@ -154,7 +154,7 @@ void *Z_Malloc(int size) 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); @@ -168,7 +168,7 @@ void *Z_TagMalloc(int size, int tag) 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); @@ -266,17 +266,17 @@ void Z_CheckHeap(void) 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) { - 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) { - 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) { - Sys_Error(__FUNCTION__ ": trahsed sentinel"); + Sys_Error("%s: trahsed sentinel", __func__); } 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 // 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) - Sys_Error(__FUNCTION__ ": bad size"); + Sys_Error("%s: bad size", __func__); next = (hunk_t *)((byte *)h + h->size); count++; @@ -429,14 +429,14 @@ void *Hunk_AllocName(int size, const char *name) { 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); 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); @@ -467,7 +467,7 @@ void Hunk_FreeToLowMark(int mark) { 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; @@ -494,7 +494,7 @@ void Hunk_FreeToHighMark(int mark) 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; @@ -511,7 +511,7 @@ void *Hunk_HighAllocName(int size, const char *name) hunk_t *h; if (size < 0) { - Sys_Error(__FUNCTION__ ": bad size: %i", size); + Sys_Error("%s: bad size: %i", __func__, size); } 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) { - Con_Printf(__FUNCTION__ ": failed on %i bytes\n", size); + Con_Printf("%s: failed on %i bytes\n", __func__, size); return 0; } @@ -675,7 +675,7 @@ void Cache_UnlinkLRU(cache_system_t *cs) { 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; @@ -687,7 +687,7 @@ void Cache_MakeLRU(cache_system_t *cs) { 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; @@ -714,7 +714,7 @@ cache_system_t *Cache_TryAlloc(int size, qboolean nobottom) { 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); @@ -955,7 +955,7 @@ void Cache_Free(cache_user_t *c) { if (!c->data) { - Sys_Error(__FUNCTION__ ": not allocated"); + Sys_Error("%s: not allocated", __func__); } 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) { - Sys_Error(__FUNCTION__ ": already allocated"); + Sys_Error("%s: already allocated", __func__); } if (size <= 0) { - Sys_Error(__FUNCTION__ ": size %i", size); + Sys_Error("%s: size %i", __func__, size); } while (true) @@ -1036,7 +1036,7 @@ void *Cache_Alloc(cache_user_t *c, int size, char *name) 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); @@ -1072,7 +1072,7 @@ void Memory_Init(void *buf, int size) } 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__); } } diff --git a/rehlds/hookers/hooker.cpp b/rehlds/hookers/hooker.cpp index fbb49af..cb6908d 100644 --- a/rehlds/hookers/hooker.cpp +++ b/rehlds/hookers/hooker.cpp @@ -44,7 +44,7 @@ void *GetOriginalFuncAddrOrDie(const char *funcName) 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; } @@ -67,7 +67,7 @@ void *GetFuncRefAddrOrDie(const char *funcName) 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; } @@ -98,7 +98,7 @@ int HookEngine(size_t addr) if (!GetAddress(&g_EngineModule, (Address*)refData, g_BaseOffset)) { #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; #endif } @@ -111,7 +111,7 @@ int HookEngine(size_t addr) if (!GetAddress(&g_EngineModule, (Address*)refFunc, g_BaseOffset)) { #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; #endif } @@ -124,7 +124,7 @@ int HookEngine(size_t addr) if (!GetAddress(&g_EngineModule, (Address*)hookFunc, g_BaseOffset)) { #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; #endif } @@ -134,7 +134,7 @@ int HookEngine(size_t addr) if (!success) { #if _DEBUG - printf("%s: failed to hook engine!\n", __FUNCTION__); + printf("%s: failed to hook engine!\n", __func__); #endif return (FALSE); } diff --git a/rehlds/hookers/memory.cpp b/rehlds/hookers/memory.cpp index ce48769..d069c89 100644 --- a/rehlds/hookers/memory.cpp +++ b/rehlds/hookers/memory.cpp @@ -420,13 +420,13 @@ void ProcessModuleData(Module *module) int i = 0; PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)module->base; if (dosHeader->e_magic != IMAGE_DOS_SIGNATURE) { - rehlds_syserror(__FUNCTION__ ": Invalid DOS header signature"); + rehlds_syserror("%s: Invalid DOS header signature", __func__); return; } PIMAGE_NT_HEADERS NTHeaders = (PIMAGE_NT_HEADERS)((size_t)module->base + dosHeader->e_lfanew); if (NTHeaders->Signature != 0x4550) { - rehlds_syserror(__FUNCTION__ ": Invalid NT header signature"); + rehlds_syserror("%s: Invalid NT header signature", __func__); return; } @@ -440,7 +440,7 @@ void ProcessModuleData(Module *module) } if (CodeSection == NULL) { - rehlds_syserror(__FUNCTION__ ": Code section not found"); + rehlds_syserror("%s: Code section not found", __func__); return; } diff --git a/rehlds/msvc/ReHLDS.vcxproj b/rehlds/msvc/ReHLDS.vcxproj index 6abe453..d3e397f 100644 --- a/rehlds/msvc/ReHLDS.vcxproj +++ b/rehlds/msvc/ReHLDS.vcxproj @@ -529,7 +529,6 @@ - diff --git a/rehlds/msvc/ReHLDS.vcxproj.filters b/rehlds/msvc/ReHLDS.vcxproj.filters index a26fe7d..1c3350b 100644 --- a/rehlds/msvc/ReHLDS.vcxproj.filters +++ b/rehlds/msvc/ReHLDS.vcxproj.filters @@ -765,9 +765,6 @@ public\tier0 - - public\tier0 - public\tier0 diff --git a/rehlds/public/rehlds/cmd_rehlds.h b/rehlds/public/rehlds/cmd_rehlds.h index 0f5de26..9337575 100644 --- a/rehlds/public/rehlds/cmd_rehlds.h +++ b/rehlds/public/rehlds/cmd_rehlds.h @@ -33,7 +33,7 @@ typedef void(*xcommand_t)(void); typedef struct cmd_function_s { struct cmd_function_s *next; - char *name; + const char *name; xcommand_t function; int flags; } cmd_function_t; diff --git a/rehlds/public/rehlds/eiface.h b/rehlds/public/rehlds/eiface.h index 8081743..b679719 100644 --- a/rehlds/public/rehlds/eiface.h +++ b/rehlds/public/rehlds/eiface.h @@ -258,7 +258,7 @@ typedef struct enginefuncs_s 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. // NOTE: these functions take player entity indices (starting at 1). diff --git a/rehlds/public/rehlds/osconfig.h b/rehlds/public/rehlds/osconfig.h index cf6a551..ad22f95 100644 --- a/rehlds/public/rehlds/osconfig.h +++ b/rehlds/public/rehlds/osconfig.h @@ -79,9 +79,6 @@ #include #include #include - - // Deail with stupid macro in kernel.h - #undef __FUNCTION__ #endif // _WIN32 #include @@ -92,7 +89,13 @@ #include #include + #ifdef _WIN32 // WINDOWS + // Define __func__ on VS less than 2015 + #if _MSC_VER < 1900 + #define __func__ __FUNCTION__ + #endif + #define _CRT_SECURE_NO_WARNINGS #define WIN32_LEAN_AND_MEAN @@ -106,6 +109,10 @@ #define NORETURN __declspec(noreturn) #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 int SOCKET_MSGLEN(SOCKET s, u_long& r) { return ioctlsocket(s, FIONREAD, (u_long*)&r); } typedef int socklen_t; @@ -124,11 +131,6 @@ VirtualFree(ptr, 0, MEM_RELEASE); } #else // _WIN32 - #ifdef __FUNCTION__ - #undef __FUNCTION__ - #endif - #define __FUNCTION__ __func__ - #ifndef PAGESIZE #define PAGESIZE 4096 #endif @@ -152,6 +154,12 @@ #define NORETURN __attribute__((noreturn)) #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 int SOCKET_MSGLEN(SOCKET s, u_long& r) { return ioctl(s, FIONREAD, (int*)&r); } typedef int SOCKET; @@ -191,4 +199,8 @@ #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 const char* template_nameof_variable(const T& /*validate_type*/, const char* name) { return name; } + #endif // _OSCONFIG_H diff --git a/rehlds/public/rehlds/rehlds_api.h b/rehlds/public/rehlds/rehlds_api.h index b0fbc90..748b8b7 100644 --- a/rehlds/public/rehlds/rehlds_api.h +++ b/rehlds/public/rehlds/rehlds_api.h @@ -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); void(*SV_UpdateUserInfo)(IGameClient *pGameClient); bool(*StripUnprintableAndSpace)(char *pch); - void(*Cmd_RemoveCmd)(char *cmd_name); + void(*Cmd_RemoveCmd)(const char *cmd_name); }; class IRehldsApi { diff --git a/rehlds/public/rehlds/static_map.h b/rehlds/public/rehlds/static_map.h index 0a6de4d..11235d7 100644 --- a/rehlds/public/rehlds/static_map.h +++ b/rehlds/public/rehlds/static_map.h @@ -44,7 +44,7 @@ private: // this was a root node unsigned int rootId = GetRoodNodeId(node->key); if (m_RootNodes[rootId] != node) { - Sys_Error(__FUNCTION__ ": invalid root node"); + Sys_Error("%s: invalid root node", __func__); return; } diff --git a/rehlds/public/tier0/fasttimer.h b/rehlds/public/tier0/fasttimer.h deleted file mode 100644 index d6ef979..0000000 --- a/rehlds/public/tier0/fasttimer.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/rehlds/public/tier0/platform.h b/rehlds/public/tier0/platform.h index dbf6c10..a263ab8 100644 --- a/rehlds/public/tier0/platform.h +++ b/rehlds/public/tier0/platform.h @@ -456,7 +456,7 @@ PLATFORM_INTERFACE bool Plat_FastVerifyHardwareKey(); //----------------------------------------------------------------------------- // Include additional dependant header components. //----------------------------------------------------------------------------- -#include "tier0/fasttimer.h" +//#include "tier0/fasttimer.h" //----------------------------------------------------------------------------- @@ -606,7 +606,7 @@ struct __MetaLooper_##NAME<0> \ class NAME \ { \ private: \ - static const __MetaLooper_##NAME m; \ + static const __MetaLooper_##NAME m; \ public: \ enum { count = COUNT }; \ static const __Type_##NAME* functions; \ diff --git a/rehlds/rehlds/FlightRecorderImpl.cpp b/rehlds/rehlds/FlightRecorderImpl.cpp index c0aa7f4..b52e44a 100644 --- a/rehlds/rehlds/FlightRecorderImpl.cpp +++ b/rehlds/rehlds/FlightRecorderImpl.cpp @@ -22,7 +22,7 @@ CRehldsFlightRecorder::CRehldsFlightRecorder() { m_DataRegion = (uint8*) sys_allocmem(DATA_REGION_SIZE); if (!m_MetaRegion || !m_DataRegion) { - Sys_Error(__FUNCTION__ ": direct allocation failed"); + Sys_Error("%s: direct allocation failed", __func__); } //initialize meta region header @@ -36,7 +36,7 @@ CRehldsFlightRecorder::CRehldsFlightRecorder() { metaPos += sizeof(recorder_state); 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 @@ -48,7 +48,7 @@ CRehldsFlightRecorder::CRehldsFlightRecorder() { dataPos += sizeof(data_header); if ((dataPos - (char*)m_pDataHeader) > DATA_REGION_HEADER) { - Sys_Error(__FUNCTION__ ": Data header overflow"); + Sys_Error("%s: Data header overflow", __func__); } InitHeadersContent(); @@ -93,7 +93,7 @@ void CRehldsFlightRecorder::MoveToStart() { void CRehldsFlightRecorder::StartMessage(uint16 msg, bool entrance) { 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) { @@ -101,7 +101,7 @@ void CRehldsFlightRecorder::StartMessage(uint16 msg, bool entrance) { } 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; @@ -121,7 +121,7 @@ void CRehldsFlightRecorder::EndMessage(uint16 msg, bool entrance) { } 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; @@ -131,7 +131,7 @@ void CRehldsFlightRecorder::EndMessage(uint16 msg, bool entrance) { unsigned int msgSize = m_pRecorderState->wpos - m_pRecorderState->lastMsgBeginPos; 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; m_pRecorderState->wpos += 2; @@ -142,13 +142,13 @@ void CRehldsFlightRecorder::EndMessage(uint16 msg, bool entrance) { void CRehldsFlightRecorder::CheckSize(unsigned int wantToWriteLen) { unsigned int msgSize = m_pRecorderState->wpos - m_pRecorderState->lastMsgBeginPos; 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) { if (m_pRecorderState->curMessage == 0) { - Sys_Error(__FUNCTION__ ": Could not write, invalid state"); + Sys_Error("%s: Could not write, invalid state", __func__); } 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) { 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; diff --git a/rehlds/rehlds/FlightRecorderImpl.h b/rehlds/rehlds/FlightRecorderImpl.h index 7359f77..7356cce 100644 --- a/rehlds/rehlds/FlightRecorderImpl.h +++ b/rehlds/rehlds/FlightRecorderImpl.h @@ -79,7 +79,7 @@ private: template void WritePrimitive(T v) { 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)); diff --git a/rehlds/rehlds/RehldsRuntimeConfig.cpp b/rehlds/rehlds/RehldsRuntimeConfig.cpp index 5eb9ddc..415c910 100644 --- a/rehlds/rehlds/RehldsRuntimeConfig.cpp +++ b/rehlds/rehlds/RehldsRuntimeConfig.cpp @@ -11,7 +11,7 @@ CRehldsRuntimeConfig::CRehldsRuntimeConfig() void CRehldsRuntimeConfig::parseFromCommandLine(const char* cmdLine) { 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); char* cpos = localBuf; @@ -23,7 +23,7 @@ void CRehldsRuntimeConfig::parseFromCommandLine(const char* cmdLine) { if (!strcmp(token, "--rehlds-test-record")) { const char* fname = getNextToken(&cpos); - if (fname == NULL) rehlds_syserror("%s: usage: --rehlds-test-record ", __FUNCTION__); + if (fname == NULL) rehlds_syserror("%s: usage: --rehlds-test-record ", __func__); strncpy(testRecordingFileName, fname, sizeof(testRecordingFileName)); testRecordingFileName[sizeof(testRecordingFileName) - 1] = 0; testPlayerMode = TPM_RECORD; @@ -31,7 +31,7 @@ void CRehldsRuntimeConfig::parseFromCommandLine(const char* cmdLine) { else if (!strcmp(token, "--rehlds-test-play")) { const char* fname = getNextToken(&cpos); - if (fname == NULL) rehlds_syserror("%s: usage: --rehlds-test-play ", __FUNCTION__); + if (fname == NULL) rehlds_syserror("%s: usage: --rehlds-test-play ", __func__); strncpy(testRecordingFileName, fname, sizeof(testRecordingFileName)); testRecordingFileName[sizeof(testRecordingFileName) - 1] = 0; testPlayerMode = TPM_PLAY; @@ -39,7 +39,7 @@ void CRehldsRuntimeConfig::parseFromCommandLine(const char* cmdLine) { else if (!strcmp(token, "--rehlds-test-anon")) { const char* fname = getNextToken(&cpos); - if (fname == NULL) rehlds_syserror("%s: usage: --rehlds-test-anon ", __FUNCTION__); + if (fname == NULL) rehlds_syserror("%s: usage: --rehlds-test-anon ", __func__); strncpy(testRecordingFileName, fname, sizeof(testRecordingFileName)); testRecordingFileName[sizeof(testRecordingFileName) - 1] = 0; testPlayerMode = TPM_ANONYMIZE; diff --git a/rehlds/rehlds/hookchains_impl.cpp b/rehlds/rehlds/hookchains_impl.cpp index 07c61c2..13f6e36 100644 --- a/rehlds/rehlds/hookchains_impl.cpp +++ b/rehlds/rehlds/hookchains_impl.cpp @@ -40,11 +40,11 @@ bool AbstractHookChainRegistry::findHook(void* hookFunc) const void AbstractHookChainRegistry::addHook(void* hookFunc, int priority) { 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)) { - 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++) @@ -63,7 +63,7 @@ void AbstractHookChainRegistry::addHook(void* hookFunc, int priority) } 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++; diff --git a/rehlds/rehlds/hookchains_impl.h b/rehlds/rehlds/hookchains_impl.h index 513b87f..0c79d68 100644 --- a/rehlds/rehlds/hookchains_impl.h +++ b/rehlds/rehlds/hookchains_impl.h @@ -40,7 +40,7 @@ public: IHookChainImpl(void** hooks, origfunc_t orig) : m_Hooks(hooks), m_OriginalFunc(orig) { if (orig == NULL) - Sys_Error(__FUNCTION__ ": Non-void HookChain without original function."); + Sys_Error("%s: Non-void HookChain without original function.", __func__); } virtual ~IHookChainImpl() {} diff --git a/rehlds/rehlds/platform.cpp b/rehlds/rehlds/platform.cpp index f59f479..21a08f6 100644 --- a/rehlds/rehlds/platform.cpp +++ b/rehlds/rehlds/platform.cpp @@ -19,7 +19,7 @@ CSimplePlatform::CSimplePlatform() { wsock = LoadLibraryA("wsock32.dll"); setsockopt_v11 = (setsockopt_proto)GetProcAddress(wsock, "setsockopt"); if (setsockopt_v11 == NULL) - rehlds_syserror("%s: setsockopt_v11 not found", __FUNCTION__); + rehlds_syserror("%s: setsockopt_v11 not found", __func__); #endif } diff --git a/rehlds/rehlds/rehlds_interfaces_impl.cpp b/rehlds/rehlds/rehlds_interfaces_impl.cpp index 0ffc89f..5c2bdb8 100644 --- a/rehlds/rehlds/rehlds_interfaces_impl.cpp +++ b/rehlds/rehlds/rehlds_interfaces_impl.cpp @@ -163,7 +163,7 @@ bool EXT_FUNC CRehldsServerStatic::IsLogActive() IGameClient* EXT_FUNC CRehldsServerStatic::GetClient(int id) { 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]; } @@ -171,7 +171,7 @@ IGameClient* EXT_FUNC CRehldsServerStatic::GetClient(int id) client_t* EXT_FUNC CRehldsServerStatic::GetClient_t(int id) { 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]; } @@ -288,7 +288,7 @@ IGameClient* GetRehldsApiClient(client_t* cl) int idx = cl - g_psvs.clients; 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]; diff --git a/rehlds/testsuite/anonymizer.cpp b/rehlds/testsuite/anonymizer.cpp index b1d96b3..e59806d 100644 --- a/rehlds/testsuite/anonymizer.cpp +++ b/rehlds/testsuite/anonymizer.cpp @@ -16,7 +16,7 @@ void* CSteamCallbackAnonymizingWrapper::Anonymize(void* data) { { static GSClientApprove_t cbdata; 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; } @@ -24,7 +24,7 @@ void* CSteamCallbackAnonymizingWrapper::Anonymize(void* data) { { static GSClientDeny_t cbdata; 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; } @@ -32,7 +32,7 @@ void* CSteamCallbackAnonymizingWrapper::Anonymize(void* data) { { static GSClientKick_t cbdata; 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; } @@ -42,22 +42,22 @@ void* CSteamCallbackAnonymizingWrapper::Anonymize(void* data) { return data; default: - rehlds_syserror("%s: unsupported callback %u", __FUNCTION__, m_iCallback); + rehlds_syserror("%s: unsupported callback %u", __func__, m_iCallback); } return NULL; } void* CSteamCallbackAnonymizingWrapper::Anonymize(void* data, bool bIOFailure, SteamAPICall_t hSteamAPICall) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return NULL; } void CSteamCallbackAnonymizingWrapper::Run(void *pvParam) { - if (m_Wrapped->GetICallback() != this->GetICallback()) rehlds_syserror("%s: iCallback desync", __FUNCTION__); - if (m_Wrapped->GetFlags() != this->GetFlags()) rehlds_syserror("%s: flags 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", __func__); m_Wrapped->Run(Anonymize(pvParam)); this->SetFlags(m_Wrapped->GetFlags()); @@ -66,8 +66,8 @@ void CSteamCallbackAnonymizingWrapper::Run(void *pvParam) 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->GetFlags() != this->GetFlags()) rehlds_syserror("%s: flags 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", __func__); m_Wrapped->Run(Anonymize(pvParam, bIOFailure, hSteamAPICall), bIOFailure, hSteamAPICall); this->SetFlags(m_Wrapped->GetFlags()); @@ -91,25 +91,25 @@ CSteamAppsAnonymizingWrapper::CSteamAppsAnonymizingWrapper(ISteamApps* original, bool CSteamAppsAnonymizingWrapper::BIsSubscribed() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } bool CSteamAppsAnonymizingWrapper::BIsLowViolence() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } bool CSteamAppsAnonymizingWrapper::BIsCybercafe() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } bool CSteamAppsAnonymizingWrapper::BIsVACBanned() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } @@ -121,82 +121,82 @@ const char* CSteamAppsAnonymizingWrapper::GetCurrentGameLanguage() const char* CSteamAppsAnonymizingWrapper::GetAvailableGameLanguages() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return NULL; } bool CSteamAppsAnonymizingWrapper::BIsSubscribedApp(AppId_t appID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } bool CSteamAppsAnonymizingWrapper::BIsDlcInstalled(AppId_t appID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } uint32 CSteamAppsAnonymizingWrapper::GetEarliestPurchaseUnixTime(AppId_t nAppID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return 0; } bool CSteamAppsAnonymizingWrapper::BIsSubscribedFromFreeWeekend() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } int CSteamAppsAnonymizingWrapper::GetDLCCount() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return 0; } 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; } void CSteamAppsAnonymizingWrapper::InstallDLC(AppId_t nAppID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamAppsAnonymizingWrapper::UninstallDLC(AppId_t nAppID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } 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) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } bool CSteamAppsAnonymizingWrapper::MarkContentCorrupt(bool bMissingFilesOnly) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } uint32 CSteamAppsAnonymizingWrapper::GetInstalledDepots(DepotId_t *pvecDepots, uint32 cMaxDepots) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return 0; } uint32 CSteamAppsAnonymizingWrapper::GetAppInstallDir(AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); 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) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } @@ -239,7 +239,7 @@ void CSteamGameServerAnonymizingWrapper::SetDedicatedServer(bool bDedicated) void CSteamGameServerAnonymizingWrapper::LogOn(const char *pszAccountName, const char *pszPassword) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamGameServerAnonymizingWrapper::LogOnAnonymous() @@ -303,12 +303,12 @@ void CSteamGameServerAnonymizingWrapper::SetPasswordProtected(bool bPasswordProt void CSteamGameServerAnonymizingWrapper::SetSpectatorPort(uint16 unSpectatorPort) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamGameServerAnonymizingWrapper::SetSpectatorServerName(const char *pszSpectatorServerName) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamGameServerAnonymizingWrapper::ClearAllKeyValues() @@ -323,25 +323,25 @@ void CSteamGameServerAnonymizingWrapper::SetKeyValue(const char *pKey, const cha void CSteamGameServerAnonymizingWrapper::SetGameTags(const char *pchGameTags) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamGameServerAnonymizingWrapper::SetGameData(const char *pchGameData) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } 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) { - 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); if (res) { - *pSteamIDUser = m_Anonymizer->Real2FakeSteamId(*pSteamIDUser, __FUNCTION__); + *pSteamIDUser = m_Anonymizer->Real2FakeSteamId(*pSteamIDUser, __func__); } return res; } @@ -354,14 +354,14 @@ CSteamID CSteamGameServerAnonymizingWrapper::CreateUnauthenticatedUserConnection void CSteamGameServerAnonymizingWrapper::SendUserDisconnect(CSteamID steamIDUser) { - CSteamID real = m_Anonymizer->Fake2RealSteamId(steamIDUser, __FUNCTION__); + CSteamID real = m_Anonymizer->Fake2RealSteamId(steamIDUser, __func__); m_Wrapped->SendUserDisconnect(real); } bool CSteamGameServerAnonymizingWrapper::BUpdateUserData(CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore) { - CSteamID real = steamIDUser.BAnonAccount() ? steamIDUser : m_Anonymizer->Fake2RealSteamId(steamIDUser, __FUNCTION__); - std::string realName = m_Anonymizer->Fake2RealName(pchPlayerName, __FUNCTION__); + CSteamID real = steamIDUser.BAnonAccount() ? steamIDUser : m_Anonymizer->Fake2RealSteamId(steamIDUser, __func__); + std::string realName = m_Anonymizer->Fake2RealName(pchPlayerName, __func__); bool res = m_Wrapped->BUpdateUserData(real, realName.c_str(), uScore); return res; @@ -369,58 +369,58 @@ bool CSteamGameServerAnonymizingWrapper::BUpdateUserData(CSteamID steamIDUser, c HAuthTicket CSteamGameServerAnonymizingWrapper::GetAuthSessionTicket(void *pTicket, int cbMaxTicket, uint32 *pcbTicket) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return k_HAuthTicketInvalid; } 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; } void CSteamGameServerAnonymizingWrapper::EndAuthSession(CSteamID steamID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } 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) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return k_EUserHasLicenseResultDoesNotHaveLicense; } bool CSteamGameServerAnonymizingWrapper::RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } void CSteamGameServerAnonymizingWrapper::GetGameplayStats() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } SteamAPICall_t CSteamGameServerAnonymizingWrapper::GetServerReputation() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return k_uAPICallInvalid; } uint32 CSteamGameServerAnonymizingWrapper::GetPublicIP() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return 0; } 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; 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); if (res > 0) { - uint32 fakeIp = m_Anonymizer->Real2FakeIp(ntohl(*pNetAdr), __FUNCTION__); + uint32 fakeIp = m_Anonymizer->Real2FakeIp(ntohl(*pNetAdr), __func__); *pNetAdr = htonl(fakeIp); //Clear players list @@ -466,18 +466,18 @@ void CSteamGameServerAnonymizingWrapper::SetHeartbeatInterval(int iHeartbeatInte void CSteamGameServerAnonymizingWrapper::ForceHeartbeat() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } SteamAPICall_t CSteamGameServerAnonymizingWrapper::AssociateWithClan(CSteamID steamIDClan) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return k_uAPICallInvalid; } SteamAPICall_t CSteamGameServerAnonymizingWrapper::ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); 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); if (res > 0) { - Real2FakeSockaddr(from, __FUNCTION__); + Real2FakeSockaddr(from, __func__); if (res > 4 && (*(uint32*)buf) == 0xFFFFFFFF) { unsigned int localLen = res; ProcessConnectionlessPacket((uint8*)buf, &localLen); @@ -613,7 +613,7 @@ int CAnonymizingEngExtInterceptor::sendto(SOCKET s, const char* buf, int len, in sockaddr saddr; memcpy(&saddr, to, sizeof(sockaddr_in)); - Fake2RealSockaddr(&saddr, __FUNCTION__); + Fake2RealSockaddr(&saddr, __func__); int res = m_BasePlatform->sendto(s, buf, len, flags, &saddr, tolen); return res; @@ -639,7 +639,7 @@ int CAnonymizingEngExtInterceptor::WSAGetLastError() 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()); return res; } @@ -648,7 +648,7 @@ int CAnonymizingEngExtInterceptor::gethostname(char *name, int namelen) { int res = m_BasePlatform->gethostname(name, namelen); if (res == 0) { - auto s = Real2FakeHost(name, __FUNCTION__); + auto s = Real2FakeHost(name, __func__); strncpy(name, s.c_str(), namelen); name[namelen - 1] = 0; } @@ -675,8 +675,8 @@ void CAnonymizingEngExtInterceptor::SteamAPI_RegisterCallback(CCallbackBase *pCa { CSteamCallbackAnonymizingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback); - if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __FUNCTION__); - //if (wrappee->GetICallback() != pCallback->GetICallback()) 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", __func__); m_BasePlatform->SteamAPI_RegisterCallback(wrappee, iCallback); @@ -695,8 +695,8 @@ void CAnonymizingEngExtInterceptor::SteamAPI_UnregisterCallResult(class CCallbac { CSteamCallbackAnonymizingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback); - if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __FUNCTION__); - if (wrappee->GetICallback() != pCallback->GetICallback()) 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", __func__); m_BasePlatform->SteamAPI_UnregisterCallResult(wrappee, hAPICall); @@ -768,8 +768,8 @@ void CAnonymizingEngExtInterceptor::SteamAPI_UnregisterCallback(CCallbackBase *p { CSteamCallbackAnonymizingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback); - if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __FUNCTION__); - if (wrappee->GetICallback() != pCallback->GetICallback()) 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", __func__); m_BasePlatform->SteamAPI_UnregisterCallback(wrappee); @@ -782,11 +782,11 @@ void CAnonymizingEngExtInterceptor::AnonymizeAddr(const char* real, const char* netadr_t fakeAdr; 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)) { - rehlds_syserror("%s: Invalid address %s", __FUNCTION__, realAdr); + rehlds_syserror("%s: Invalid address %s", __func__, realAdr); } AnonymizeAddr(realAdr, fakeAdr); @@ -945,7 +945,7 @@ void CAnonymizingEngExtInterceptor::ProcessConnectPacket(uint8* data, unsigned i 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); userinfo[0] = 0; diff --git a/rehlds/testsuite/funccalls.cpp b/rehlds/testsuite/funccalls.cpp index c557781..43904bc 100644 --- a/rehlds/testsuite/funccalls.cpp +++ b/rehlds/testsuite/funccalls.cpp @@ -40,7 +40,7 @@ void PrintBinaryArray(const char* data, int dataLen, std::stringstream &ss) { ss << "["; for (int i = 0; i < dataLen; i++) - ss << " " << (unsigned int) (unsigned char)data[i]; + ss << " " << (unsigned int)(unsigned char)data[i]; ss << "]"; } @@ -66,14 +66,14 @@ bool CompareSockAddrs(void* ps1, void* ps2) { break; 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); } /* ============================================================================ - CSleepExtCall + CSleepExtCall ============================================================================ */ CSleepExtCall::CSleepExtCall(DWORD time) { @@ -109,7 +109,7 @@ void CSleepExtCall::readPrologue(std::istream &stream) /* ============================================================================ - CQueryPerfFreqCall + CQueryPerfFreqCall ============================================================================ */ std::string CQueryPerfFreqCall::toString() { @@ -142,7 +142,7 @@ void CQueryPerfFreqCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CQueryPerfCounterCall + CQueryPerfCounterCall ============================================================================ */ std::string CQueryPerfCounterCall::toString() { @@ -176,7 +176,7 @@ void CQueryPerfCounterCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CGetTickCountCall + CGetTickCountCall ============================================================================ */ std::string CGetTickCountCall::toString() { @@ -207,7 +207,7 @@ void CGetTickCountCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CGetTickCountCall + CGetTickCountCall ============================================================================ */ std::string CGetLocalTimeCall::toString() @@ -239,7 +239,7 @@ void CGetLocalTimeCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CGetSystemTimeCall + CGetSystemTimeCall ============================================================================ */ std::string CGetSystemTimeCall::toString() { @@ -270,7 +270,7 @@ void CGetSystemTimeCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CGetTimeZoneInfoCall + CGetTimeZoneInfoCall ============================================================================ */ std::string CGetTimeZoneInfoCall::toString() { @@ -279,7 +279,7 @@ std::string CGetTimeZoneInfoCall::toString() << " Bias: " << m_Res.Bias << " StandardName: " << m_Res.StandardName << " StandardDate: "; PrintSystemTime(&m_Res.StandardDate, ss); - + ss << " StandardBias: " << m_Res.StandardBias << " DaylightName: " << m_Res.DaylightName << " 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) { @@ -364,7 +364,7 @@ void CSocketCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CIoCtlSocketCall + CIoCtlSocketCall ============================================================================ */ 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) { @@ -508,7 +508,7 @@ void CSetSockOptCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CCloseSocketCall + CCloseSocketCall ============================================================================ */ 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) { @@ -599,15 +599,15 @@ bool CRecvFromCall::compareInputArgs(IEngExtCall* other, bool strict) void CRecvFromCall::setResult(const void* data, const void* from, int fromLen, int res) { 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)) - 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_Res = res; - if (res > 0) + if (res > 0) memcpy(m_Data, data, res); 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) { 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)) - 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_Len = len; @@ -695,15 +695,19 @@ bool CSendToCall::compareInputArgs(IEngExtCall* other, bool strict) if (strict) { if (otherCall->m_Len != m_Len) return false; - } else { + } + else { int maxDiff; if (m_Len < 40) { maxDiff = 10; - } else if (m_Len < 90) { + } + else if (m_Len < 90) { maxDiff = 15; - } else if (m_Len < 120) { + } + else if (m_Len < 120) { maxDiff = 18; - } else { + } + else { maxDiff = m_Len / 8; } 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) { 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_AddrLen = addrlen; @@ -829,7 +833,7 @@ void CBindCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CGetSockNameCall + CGetSockNameCall ============================================================================ */ CGetSockNameCall::CGetSockNameCall(SOCKET s, int addrlen) { @@ -850,7 +854,7 @@ std::string CGetSockNameCall::toString() void CGetSockNameCall::setResult(const void* addr, int addrlen, int res) { 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_AddrLenOut = addrlen; @@ -898,7 +902,7 @@ void CGetSockNameCall::readEpilogue(std::istream &stream) { .read((char*)&m_Res, 4); stream.read((char*)&m_Addr, m_AddrLenOut); - + } @@ -907,7 +911,7 @@ void CGetSockNameCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CWSAGetLastErrorCall + CWSAGetLastErrorCall ============================================================================ */ 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) { 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_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) { 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_DataSize = dataSize; @@ -1069,7 +1073,7 @@ void CSteamCallbackCall2::readEpilogue(std::istream &stream) { } /* ============================================================================ - CSteamApiRegisterCallbackCall + CSteamApiRegisterCallbackCall ============================================================================ */ CSteamApiRegisterCallbackCall::CSteamApiRegisterCallbackCall(int rehldsCallbackId, int steamCallbackId, CCallbackBase* cb) { @@ -1131,7 +1135,7 @@ void CSteamApiRegisterCallbackCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CSteamApiInitCall + CSteamApiInitCall ============================================================================ */ 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) { @@ -1225,7 +1229,7 @@ void CSteamApiUnrigestierCallResultCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CSteamAppsCall + CSteamAppsCall ============================================================================ */ std::string CSteamAppsCall::toString() { @@ -1256,7 +1260,7 @@ void CSteamAppsCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CSteamAppGetCurrentGameLanguageCall + CSteamAppGetCurrentGameLanguageCall ============================================================================ */ std::string CSteamAppGetCurrentGameLanguageCall::toString() @@ -1269,11 +1273,11 @@ std::string CSteamAppGetCurrentGameLanguageCall::toString() void CSteamAppGetCurrentGameLanguageCall::setResult(const char* res) { if (res == NULL) - rehlds_syserror("%s: null result", __FUNCTION__); + rehlds_syserror("%s: null result", __func__); m_ResLen = strlen(res) + 1; 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); } @@ -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) { if (pchVersionString == NULL) - rehlds_syserror("%s: version is null", __FUNCTION__); + rehlds_syserror("%s: version is null", __func__); m_VersionLen = strlen(pchVersionString) + 1; 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); m_IP = unIP; @@ -1398,7 +1402,7 @@ void CSteamGameServerInitCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CSteamGameServerCall + CSteamGameServerCall ============================================================================ */ std::string CSteamGameServerCall::toString() { @@ -1430,16 +1434,16 @@ void CSteamGameServerCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CGameServerSetProductCall + CGameServerSetProductCall ============================================================================ */ CGameServerSetProductCall::CGameServerSetProductCall(const char* product) { if (product == NULL) - rehlds_syserror("%s: product is null", __FUNCTION__); + rehlds_syserror("%s: product is null", __func__); m_ProductLen = strlen(product) + 1; 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); } @@ -1482,16 +1486,16 @@ void CGameServerSetProductCall::readPrologue(std::istream &stream) { /* ============================================================================ - CGameServerSetModDirCall + CGameServerSetModDirCall ============================================================================ */ CGameServerSetModDirCall::CGameServerSetModDirCall(const char* dir) { if (dir == NULL) - rehlds_syserror("%s: dir is null", __FUNCTION__); + rehlds_syserror("%s: dir is null", __func__); m_DirLen = strlen(dir) + 1; 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); } @@ -1534,7 +1538,7 @@ void CGameServerSetModDirCall::readPrologue(std::istream &stream) { /* ============================================================================ - CGameServerSetDedicatedServerCall + CGameServerSetDedicatedServerCall ============================================================================ */ CGameServerSetDedicatedServerCall::CGameServerSetDedicatedServerCall(bool dedicated) { @@ -1574,16 +1578,16 @@ void CGameServerSetDedicatedServerCall::readPrologue(std::istream &stream) { /* ============================================================================ - CGameServerSetGameDescCall + CGameServerSetGameDescCall ============================================================================ */ CGameServerSetGameDescCall::CGameServerSetGameDescCall(const char* desc) { if (desc == NULL) - rehlds_syserror("%s: desc is null", __FUNCTION__); + rehlds_syserror("%s: desc is null", __func__); m_DescLen = strlen(desc) + 1; 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); } @@ -1625,7 +1629,7 @@ void CGameServerSetGameDescCall::readPrologue(std::istream &stream) { /* ============================================================================ - CGameServerLogOnAnonymousCall + CGameServerLogOnAnonymousCall ============================================================================ */ std::string CGameServerLogOnAnonymousCall::toString() { @@ -1648,7 +1652,7 @@ bool CGameServerLogOnAnonymousCall::compareInputArgs(IEngExtCall* other, bool st /* ============================================================================ - CGameServerEnableHeartbeatsCall + CGameServerEnableHeartbeatsCall ============================================================================ */ CGameServerEnableHeartbeatsCall::CGameServerEnableHeartbeatsCall(bool hearbeats) { @@ -1688,7 +1692,7 @@ void CGameServerEnableHeartbeatsCall::readPrologue(std::istream &stream) { /* ============================================================================ - CGameServerSetHeartbeatIntervalCall + CGameServerSetHeartbeatIntervalCall ============================================================================ */ CGameServerSetHeartbeatIntervalCall::CGameServerSetHeartbeatIntervalCall(int interval) { @@ -1726,7 +1730,7 @@ void CGameServerSetHeartbeatIntervalCall::readPrologue(std::istream &stream) { /* ============================================================================ - CGameServerSetMaxPlayersCall + CGameServerSetMaxPlayersCall ============================================================================ */ CGameServerSetMaxPlayersCall::CGameServerSetMaxPlayersCall(int maxPlayers) { @@ -1765,7 +1769,7 @@ void CGameServerSetMaxPlayersCall::readPrologue(std::istream &stream) { /* ============================================================================ - CGameServerSetBotCountCall + CGameServerSetBotCountCall ============================================================================ */ CGameServerSetBotCountCall::CGameServerSetBotCountCall(int numBots) { @@ -1804,16 +1808,16 @@ void CGameServerSetBotCountCall::readPrologue(std::istream &stream) { /* ============================================================================ - CGameServerSetServerNameCall + CGameServerSetServerNameCall ============================================================================ */ CGameServerSetServerNameCall::CGameServerSetServerNameCall(const char* serverName) { if (serverName == NULL) - rehlds_syserror("%s: serverName is null", __FUNCTION__); + rehlds_syserror("%s: serverName is null", __func__); m_ServerNameLen = strlen(serverName) + 1; 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); } @@ -1856,16 +1860,16 @@ void CGameServerSetServerNameCall::readPrologue(std::istream &stream) { /* ============================================================================ - CGameServerSetMapNameCall + CGameServerSetMapNameCall ============================================================================ */ CGameServerSetMapNameCall::CGameServerSetMapNameCall(const char* mapName) { if (mapName == NULL) - rehlds_syserror("%s: serverName is null", __FUNCTION__); + rehlds_syserror("%s: serverName is null", __func__); m_MapNameLen = strlen(mapName) + 1; 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); } @@ -1908,7 +1912,7 @@ void CGameServerSetMapNameCall::readPrologue(std::istream &stream) { /* ============================================================================ - CGameServerSetPasswordProtectedCall + CGameServerSetPasswordProtectedCall ============================================================================ */ CGameServerSetPasswordProtectedCall::CGameServerSetPasswordProtectedCall(bool passwordProtected) { @@ -1948,7 +1952,7 @@ void CGameServerSetPasswordProtectedCall::readPrologue(std::istream &stream) { /* ============================================================================ - CGameServerClearAllKVsCall + CGameServerClearAllKVsCall ============================================================================ */ 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) { if (key == NULL) - rehlds_syserror("%s: key is null", __FUNCTION__); + rehlds_syserror("%s: key is null", __func__); m_KeyLen = strlen(key) + 1; 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); if (value == NULL) - rehlds_syserror("%s: value is null", __FUNCTION__); + rehlds_syserror("%s: value is null", __func__); m_ValueLen = strlen(value) + 1; 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); } @@ -2034,7 +2038,7 @@ void CGameServerSetKeyValueCall::readPrologue(std::istream &stream) { stream .read((char*)&m_ValueLen, sizeof(m_ValueLen)) .read((char*)&m_KeyLen, sizeof(m_KeyLen)); - + stream .read(m_Value, m_ValueLen) .read(m_Key, m_KeyLen); @@ -2044,7 +2048,7 @@ void CGameServerSetKeyValueCall::readPrologue(std::istream &stream) { /* ============================================================================ - CSteamApiSetBreakpadAppIdCall + CSteamApiSetBreakpadAppIdCall ============================================================================ */ CSteamApiSetBreakpadAppIdCall::CSteamApiSetBreakpadAppIdCall(uint32 appId) { @@ -2084,7 +2088,7 @@ void CSteamApiSetBreakpadAppIdCall::readPrologue(std::istream &stream) { /* ============================================================================ - CGameServerWasRestartRequestedCall + CGameServerWasRestartRequestedCall ============================================================================ */ std::string CGameServerWasRestartRequestedCall::toString() { @@ -2116,7 +2120,7 @@ void CGameServerWasRestartRequestedCall::readPrologue(std::istream &stream) { /* ============================================================================ - CSteamGameServerRunCallbacksCall + CSteamGameServerRunCallbacksCall ============================================================================ */ std::string CSteamGameServerRunCallbacksCall::toString() { @@ -2139,7 +2143,7 @@ bool CSteamGameServerRunCallbacksCall::compareInputArgs(IEngExtCall* other, bool /* ============================================================================ - CGameServerGetNextOutgoingPacketCall + CGameServerGetNextOutgoingPacketCall ============================================================================ */ CGameServerGetNextOutgoingPacketCall::CGameServerGetNextOutgoingPacketCall(int maxOut) { @@ -2152,17 +2156,17 @@ void CGameServerGetNextOutgoingPacketCall::setResult(void* buf, int res, uint32* m_BufLen = res > 0 ? res : 0; if (m_BufLen > 0) { 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); } m_Result = res; if (pAddr == NULL) - rehlds_syserror("%s: pAddr is NULL", __FUNCTION__); + rehlds_syserror("%s: pAddr is NULL", __func__); if (pPort == NULL) - rehlds_syserror("%s: pPort is NULL", __FUNCTION__); + rehlds_syserror("%s: pPort is NULL", __func__); m_Addr = *pAddr; m_Port = *pPort; @@ -2221,7 +2225,7 @@ void CGameServerGetNextOutgoingPacketCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CSteamApiRunCallbacksCall + CSteamApiRunCallbacksCall ============================================================================ */ std::string CSteamApiRunCallbacksCall::toString() { @@ -2244,7 +2248,7 @@ bool CSteamApiRunCallbacksCall::compareInputArgs(IEngExtCall* other, bool strict /* ============================================================================ - CGameServerGetSteamIdCall + CGameServerGetSteamIdCall ============================================================================ */ std::string CGameServerGetSteamIdCall::toString() { @@ -2275,7 +2279,7 @@ void CGameServerGetSteamIdCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CGameServerBSecureCall + CGameServerBSecureCall ============================================================================ */ 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) { m_Len = cbData; 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); m_Ip = srcIP; @@ -2380,13 +2384,13 @@ void CGameServerHandleIncomingPacketCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CGameServerSendUserConnectAndAuthenticateCall + CGameServerSendUserConnectAndAuthenticateCall ============================================================================ */ CGameServerSendUserConnectAndAuthenticateCall::CGameServerSendUserConnectAndAuthenticateCall(uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize) { m_AuthBlobLen = cubAuthBlobSize; 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); m_IP = unIPClient; @@ -2456,7 +2460,7 @@ void CGameServerSendUserConnectAndAuthenticateCall::readEpilogue(std::istream &s /* ============================================================================ - CGameServerSendUserDisconnectCall + CGameServerSendUserDisconnectCall ============================================================================ */ 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) { m_PlayerNameLen = strlen(pchPlayerName) + 1; 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); m_SteamId = steamIDUser.ConvertToUint64(); @@ -2563,7 +2567,7 @@ void CGameServerBUpdateUserDataCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CGameServerCreateUnauthUserConnectionCall + CGameServerCreateUnauthUserConnectionCall ============================================================================ */ std::string CGameServerCreateUnauthUserConnectionCall::toString() { @@ -2596,7 +2600,7 @@ void CGameServerCreateUnauthUserConnectionCall::readEpilogue(std::istream &strea /* ============================================================================ - CGetHostNameCall + CGetHostNameCall ============================================================================ */ std::string CGetHostNameCall::toString() { @@ -2622,7 +2626,7 @@ void CGetHostNameCall::setResult(char* hostName, int res) { m_NameLenOut = strlen(hostName) + 1; 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); m_Res = res; @@ -2655,13 +2659,13 @@ void CGetHostNameCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CGetHostByNameCall + CGetHostByNameCall ============================================================================ */ CGetHostByNameCall::CGetHostByNameCall(const char* name) { m_NameLen = strlen(name) + 1; if (m_NameLen > sizeof(m_Name)) - rehlds_syserror("%s: too long name", __FUNCTION__); + rehlds_syserror("%s: too long name", __func__); strcpy(m_Name, name); } @@ -2692,19 +2696,19 @@ bool CGetHostByNameCall::compareInputArgs(IEngExtCall* other, bool strict) void CGetHostByNameCall::setResult(const hostent* hostEnt) { m_HostentData.hostNameLen = strlen(hostEnt->h_name) + 1; 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); int i = 0; while (hostEnt->h_aliases[i]) { 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; 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]); @@ -2715,13 +2719,13 @@ void CGetHostByNameCall::setResult(const hostent* hostEnt) { m_HostentData.addrtype = hostEnt->h_addrtype; m_HostentData.addrLen = hostEnt->h_length; 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; while (hostEnt->h_addr_list[i]) { 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); @@ -2784,12 +2788,12 @@ void CGetHostByNameCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CGetProcessTimesCall + CGetProcessTimesCall ============================================================================ */ std::string CGetProcessTimesCall::toString() { std::stringstream ss; - + ss << "GetProcessTimes( creationTime: "; PrintFileTime(&m_CreationTime, ss); ss << "; exitTime: "; PrintFileTime(&m_ExitTime, ss); ss << "; kernelTime: "; PrintFileTime(&m_KernelTime, ss); @@ -2839,7 +2843,7 @@ void CGetProcessTimesCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CGetSystemTimeAsFileTimeCall + CGetSystemTimeAsFileTimeCall ============================================================================ */ std::string CGetSystemTimeAsFileTimeCall::toString() { @@ -2877,7 +2881,7 @@ void CGetSystemTimeAsFileTimeCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CStdTimeCall + CStdTimeCall ============================================================================ */ CStdTimeCall::CStdTimeCall(uint32* inTime) { @@ -2931,7 +2935,7 @@ void CStdTimeCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CStdLocalTimeCall + CStdLocalTimeCall ============================================================================ */ CStdLocalTimeCall::CStdLocalTimeCall(uint32 inTime) { @@ -2985,7 +2989,7 @@ void CStdLocalTimeCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CStdSrandCall + CStdSrandCall ============================================================================ */ std::string CStdSrandCall::toString() { @@ -3020,7 +3024,7 @@ void CStdSrandCall::readPrologue(std::istream &stream) { /* ============================================================================ - CStdRandCall + CStdRandCall ============================================================================ */ std::string CStdRandCall::toString() { @@ -3052,7 +3056,7 @@ void CStdRandCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CGameServerLogOffCall + CGameServerLogOffCall ============================================================================ */ std::string CGameServerLogOffCall::toString() { @@ -3075,7 +3079,7 @@ bool CGameServerLogOffCall::compareInputArgs(IEngExtCall* other, bool strict) /* ============================================================================ - CSteamGameServerShutdownCall + CSteamGameServerShutdownCall ============================================================================ */ std::string CSteamGameServerShutdownCall::toString() { @@ -3099,7 +3103,7 @@ bool CSteamGameServerShutdownCall::compareInputArgs(IEngExtCall* other, bool str /* ============================================================================ - CSteamApiUnregisterCallbackCall + CSteamApiUnregisterCallbackCall ============================================================================ */ CSteamApiUnregisterCallbackCall::CSteamApiUnregisterCallbackCall(int rehldsCallbackId, CCallbackBase* cb) { @@ -3155,7 +3159,7 @@ void CSteamApiUnregisterCallbackCall::readEpilogue(std::istream &stream) { /* ============================================================================ - CGameServerBLoggedOnCall + CGameServerBLoggedOnCall ============================================================================ */ std::string CGameServerBLoggedOnCall::toString() { @@ -3201,7 +3205,7 @@ virtual void readEpilogue(std::istream &stream); */ #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(); 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_RECVFROM: IEngExtCallFactory_CreateFuncCall(CRecvFromCall, 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_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_GET_HOST_BY_NAME: IEngExtCallFactory_CreateFuncCall(CGetHostByNameCall, 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_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_GS_BLOGGEDON: IEngExtCallFactory_CreateFuncCall(CGameServerBLoggedOnCall, buf, ptrSize); - + default: - rehlds_syserror("%s: unknown funccall opcode %d", __FUNCTION__, opc); + rehlds_syserror("%s: unknown funccall opcode %d", __func__, opc); return NULL; } } diff --git a/rehlds/testsuite/player.cpp b/rehlds/testsuite/player.cpp index 5caf865..8411772 100644 --- a/rehlds/testsuite/player.cpp +++ b/rehlds/testsuite/player.cpp @@ -36,16 +36,16 @@ CPlayingEngExtInterceptor::CPlayingEngExtInterceptor(const char* fname, bool str m_InStream.read((char*)&versionMinor, 2).read((char*)&versionMajor, 2); if (versionMajor != TESTSUITE_PROTOCOL_VERSION_MAJOR) { - rehlds_syserror("%s: protocol major version mismatch; need %d, got %d", __FUNCTION__, TESTSUITE_PROTOCOL_VERSION_MAJOR, versionMajor); + rehlds_syserror("%s: protocol major version mismatch; need %d, got %d", __func__, TESTSUITE_PROTOCOL_VERSION_MAJOR, versionMajor); } if (versionMinor > TESTSUITE_PROTOCOL_VERSION_MINOR) { - rehlds_syserror("%s: protocol minor version mismatch; need <= %d, got %d", __FUNCTION__, TESTSUITE_PROTOCOL_VERSION_MINOR, versionMinor); + rehlds_syserror("%s: protocol minor version mismatch; need <= %d, got %d", __func__, TESTSUITE_PROTOCOL_VERSION_MINOR, versionMinor); } m_InStream.read((char*)&cmdlineLen, 4); if (cmdlineLen > sizeof(cmdLine)) { - rehlds_syserror("%s: too long cmdline", __FUNCTION__); + rehlds_syserror("%s: too long cmdline", __func__); } m_InStream.read(cmdLine, cmdlineLen); @@ -66,7 +66,7 @@ void* CPlayingEngExtInterceptor::allocFuncCall() } } - rehlds_syserror("%s: running out of free slots", __FUNCTION__); + rehlds_syserror("%s: running out of free slots", __func__); return NULL; } @@ -81,7 +81,7 @@ void CPlayingEngExtInterceptor::freeFuncCall(void* fcall) } } - rehlds_syserror("%s: invalid pointer provided: %p", __FUNCTION__, fcall); + rehlds_syserror("%s: invalid pointer provided: %p", __func__, fcall); } bool CPlayingEngExtInterceptor::readFuncCall() { @@ -127,7 +127,7 @@ IEngExtCall* CPlayingEngExtInterceptor::getNextCallInternal(bool peek) { } if (m_CommandsQueue.empty()) { - rehlds_syserror("%s: command queue is empty!", __FUNCTION__); + rehlds_syserror("%s: command queue is empty!", __func__); } IEngExtCall* next = m_CommandsQueue.front(); @@ -164,7 +164,7 @@ IEngExtCall* CPlayingEngExtInterceptor::getNextCall(bool peek, bool processCallb IEngCallbackCall* callback = dynamic_cast(cmd); if (callback != NULL && callback->m_Start) { if (!processCallbacks) { - rehlds_syserror("%s: read a callback, but it's not allowed here", __FUNCTION__); + rehlds_syserror("%s: read a callback, but it's not allowed here", __func__); return NULL; } @@ -176,13 +176,13 @@ IEngExtCall* CPlayingEngExtInterceptor::getNextCall(bool peek, bool processCallb } if (cmd->getOpcode() != expectedOpcode) { - rehlds_syserror("%s: bad opcode; expected %d got %d; size left: %d", __FUNCTION__, expectedOpcode, cmd->getOpcode(), sizeLeft); + rehlds_syserror("%s: bad opcode; expected %d got %d; size left: %d", __func__, expectedOpcode, cmd->getOpcode(), sizeLeft); } if (needStart) { - if (!cmd->m_Start) rehlds_syserror("%s: bad fcall %d; expected start flag", __FUNCTION__, cmd->getOpcode()); + if (!cmd->m_Start) rehlds_syserror("%s: bad fcall %d; expected start flag", __func__, cmd->getOpcode()); } else { - if (!cmd->m_End) rehlds_syserror("%s: bad fcall %d; expected end flag", __FUNCTION__, cmd->getOpcode()); + if (!cmd->m_End) rehlds_syserror("%s: bad fcall %d; expected end flag", __func__, cmd->getOpcode()); } return cmd; @@ -200,42 +200,42 @@ void CPlayingEngExtInterceptor::playCallback(IEngCallbackCall* cb) { return; default: - rehlds_syserror("%s: unknown callback", __FUNCTION__); + rehlds_syserror("%s: unknown callback", __func__); } } void CPlayingEngExtInterceptor::playSteamCallback1(CSteamCallbackCall1* cb) { auto itr = m_SteamCallbacks.find(cb->m_CallbackId); - if (itr == m_SteamCallbacks.end()) rehlds_syserror("%s: callback %d not found", __FUNCTION__, cb->m_CallbackId); + if (itr == m_SteamCallbacks.end()) rehlds_syserror("%s: callback %d not found", __func__, cb->m_CallbackId); CCallbackBase* steamCallback = (*itr).second; - if (steamCallback->GetFlags() != cb->m_InState.m_nCallbackFlags) rehlds_syserror("%s: PRE flags desync", __FUNCTION__); - if (steamCallback->GetICallback() != cb->m_InState.m_iCallback) rehlds_syserror("%s: PRE flags desync", __FUNCTION__); + if (steamCallback->GetFlags() != cb->m_InState.m_nCallbackFlags) rehlds_syserror("%s: PRE flags desync", __func__); + if (steamCallback->GetICallback() != cb->m_InState.m_iCallback) rehlds_syserror("%s: PRE flags desync", __func__); steamCallback->Run(cb->m_Data); - CSteamCallbackCall1* endCallback = (CSteamCallbackCall1*)getNextCall(false, true, cb->getOpcode(), false, __FUNCTION__); + CSteamCallbackCall1* endCallback = (CSteamCallbackCall1*)getNextCall(false, true, cb->getOpcode(), false, __func__); - if (steamCallback->GetFlags() != endCallback->m_OutState.m_nCallbackFlags) rehlds_syserror("%s: POST flags desync", __FUNCTION__); - if (steamCallback->GetICallback() != endCallback->m_OutState.m_iCallback) rehlds_syserror("%s: POST flags desync", __FUNCTION__); + if (steamCallback->GetFlags() != endCallback->m_OutState.m_nCallbackFlags) rehlds_syserror("%s: POST flags desync", __func__); + if (steamCallback->GetICallback() != endCallback->m_OutState.m_iCallback) rehlds_syserror("%s: POST flags desync", __func__); freeFuncCall(cb); freeFuncCall(endCallback); } void CPlayingEngExtInterceptor::playSteamCallback2(CSteamCallbackCall2* cb) { auto itr = m_SteamCallbacks.find(cb->m_CallbackId); - if (itr == m_SteamCallbacks.end()) rehlds_syserror("%s: callback %d not found", __FUNCTION__, cb->m_CallbackId); + if (itr == m_SteamCallbacks.end()) rehlds_syserror("%s: callback %d not found", __func__, cb->m_CallbackId); CCallbackBase* steamCallback = (*itr).second; - if (steamCallback->GetFlags() != cb->m_InState.m_nCallbackFlags) rehlds_syserror("%s: PRE flags desync", __FUNCTION__); - if (steamCallback->GetICallback() != cb->m_InState.m_iCallback) rehlds_syserror("%s: PRE flags desync", __FUNCTION__); + if (steamCallback->GetFlags() != cb->m_InState.m_nCallbackFlags) rehlds_syserror("%s: PRE flags desync", __func__); + if (steamCallback->GetICallback() != cb->m_InState.m_iCallback) rehlds_syserror("%s: PRE flags desync", __func__); steamCallback->Run(cb->m_Data, cb->m_bIOFailure, cb->m_SteamAPICall); - CSteamCallbackCall2* endCallback = (CSteamCallbackCall2*)getNextCall(false, true, cb->getOpcode(), false, __FUNCTION__); + CSteamCallbackCall2* endCallback = (CSteamCallbackCall2*)getNextCall(false, true, cb->getOpcode(), false, __func__); - if (steamCallback->GetFlags() != endCallback->m_OutState.m_nCallbackFlags) rehlds_syserror("%s: POST flags desync", __FUNCTION__); - if (steamCallback->GetICallback() != endCallback->m_OutState.m_iCallback) rehlds_syserror("%s: POST flags desync", __FUNCTION__); + if (steamCallback->GetFlags() != endCallback->m_OutState.m_nCallbackFlags) rehlds_syserror("%s: POST flags desync", __func__); + if (steamCallback->GetICallback() != endCallback->m_OutState.m_iCallback) rehlds_syserror("%s: POST flags desync", __func__); freeFuncCall(cb); freeFuncCall(endCallback); } @@ -256,15 +256,15 @@ int CPlayingEngExtInterceptor::getOrRegisterSteamCallback(CCallbackBase* cb) { void CPlayingEngExtInterceptor::maybeHeartBeat(int readPos) { if (m_PrevHeartBeat + m_HeartBeatInterval <= readPos) { m_PrevHeartBeat = readPos; - Con_Printf("%s: readPos=%u\n", __FUNCTION__, readPos); + Con_Printf("%s: readPos=%u\n", __func__, readPos); } } uint32 CPlayingEngExtInterceptor::time(uint32* pTime) { - CStdTimeCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CSTD_TIME, true, __FUNCTION__)); - CStdTimeCall(pTime).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CStdTimeCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_CSTD_TIME, false, __FUNCTION__)); + CStdTimeCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CSTD_TIME, true, __func__)); + CStdTimeCall(pTime).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CStdTimeCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_CSTD_TIME, false, __func__)); uint32 res = playEndCall->m_Res; if (pTime != NULL) *pTime = res; @@ -276,9 +276,9 @@ uint32 CPlayingEngExtInterceptor::time(uint32* pTime) struct tm* CPlayingEngExtInterceptor::localtime(uint32 time) { - CStdLocalTimeCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CSTD_LOCALTIME, true, __FUNCTION__)); - CStdLocalTimeCall(time).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CStdLocalTimeCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_CSTD_LOCALTIME, false, __FUNCTION__)); + CStdLocalTimeCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CSTD_LOCALTIME, true, __func__)); + CStdLocalTimeCall(time).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CStdLocalTimeCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_CSTD_LOCALTIME, false, __func__)); setCurrentTm(&playEndCall->m_Res); @@ -289,17 +289,17 @@ struct tm* CPlayingEngExtInterceptor::localtime(uint32 time) void CPlayingEngExtInterceptor::srand(uint32 seed) { - CStdSrandCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CSTD_SRAND_CALL, true, __FUNCTION__)); - CStdSrandCall(seed).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CStdSrandCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_CSTD_SRAND_CALL, false, __FUNCTION__)); + CStdSrandCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CSTD_SRAND_CALL, true, __func__)); + CStdSrandCall(seed).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CStdSrandCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_CSTD_SRAND_CALL, false, __func__)); freeFuncCall(playCall); freeFuncCall(playEndCall); } int CPlayingEngExtInterceptor::rand() { - CStdRandCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CSTD_RAND_CALL, true, __FUNCTION__)); - CStdRandCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_CSTD_RAND_CALL, false, __FUNCTION__)); + CStdRandCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CSTD_RAND_CALL, true, __func__)); + CStdRandCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_CSTD_RAND_CALL, false, __func__)); int res = playEndCall->m_Res; @@ -309,16 +309,16 @@ int CPlayingEngExtInterceptor::rand() } void CPlayingEngExtInterceptor::Sleep(DWORD msec) { - CSleepExtCall* playCall = dynamic_cast(getNextCall(false, false, ECF_SLEEP, true, __FUNCTION__)); - CSleepExtCall(msec).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSleepExtCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_SLEEP, false, __FUNCTION__)); + CSleepExtCall* playCall = dynamic_cast(getNextCall(false, false, ECF_SLEEP, true, __func__)); + CSleepExtCall(msec).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CSleepExtCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_SLEEP, false, __func__)); freeFuncCall(playCall); freeFuncCall(playEndCall); } BOOL CPlayingEngExtInterceptor::QueryPerfCounter(LARGE_INTEGER* counter) { - CQueryPerfCounterCall* playCall = dynamic_cast(getNextCall(false, false, ECF_QUERY_PERF_COUNTER, true, __FUNCTION__)); - CQueryPerfCounterCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_QUERY_PERF_COUNTER, false, __FUNCTION__)); + CQueryPerfCounterCall* playCall = dynamic_cast(getNextCall(false, false, ECF_QUERY_PERF_COUNTER, true, __func__)); + CQueryPerfCounterCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_QUERY_PERF_COUNTER, false, __func__)); counter->QuadPart = playEndCall->m_Counter; BOOL res = playEndCall->m_Res; @@ -328,8 +328,8 @@ BOOL CPlayingEngExtInterceptor::QueryPerfCounter(LARGE_INTEGER* counter) { } BOOL CPlayingEngExtInterceptor::QueryPerfFreq(LARGE_INTEGER* freq) { - CQueryPerfFreqCall* playCall = dynamic_cast(getNextCall(false, false, ECF_QUERY_PERF_FREQ, true, __FUNCTION__)); - CQueryPerfFreqCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_QUERY_PERF_FREQ, false, __FUNCTION__)); + CQueryPerfFreqCall* playCall = dynamic_cast(getNextCall(false, false, ECF_QUERY_PERF_FREQ, true, __func__)); + CQueryPerfFreqCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_QUERY_PERF_FREQ, false, __func__)); freq->QuadPart = playEndCall->m_Freq; BOOL res = playEndCall->m_Res; @@ -339,8 +339,8 @@ BOOL CPlayingEngExtInterceptor::QueryPerfFreq(LARGE_INTEGER* freq) { } DWORD CPlayingEngExtInterceptor::GetTickCount() { - CGetTickCountCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_TICK_COUNT, true, __FUNCTION__)); - CGetTickCountCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_TICK_COUNT, false, __FUNCTION__)); + CGetTickCountCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_TICK_COUNT, true, __func__)); + CGetTickCountCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_TICK_COUNT, false, __func__)); DWORD res = playEndCall->m_Res; freeFuncCall(playCall); freeFuncCall(playEndCall); @@ -349,24 +349,24 @@ DWORD CPlayingEngExtInterceptor::GetTickCount() { } void CPlayingEngExtInterceptor::GetLocalTime(LPSYSTEMTIME time) { - CGetLocalTimeCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_LOCAL_TIME, true, __FUNCTION__)); - CGetLocalTimeCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_LOCAL_TIME, false, __FUNCTION__)); + CGetLocalTimeCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_LOCAL_TIME, true, __func__)); + CGetLocalTimeCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_LOCAL_TIME, false, __func__)); memcpy(time, &playEndCall->m_Res, sizeof(SYSTEMTIME)); freeFuncCall(playCall); freeFuncCall(playEndCall); } void CPlayingEngExtInterceptor::GetSystemTime(LPSYSTEMTIME time) { - CGetSystemTimeCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_SYSTEM_TIME, true, __FUNCTION__)); - CGetSystemTimeCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_SYSTEM_TIME, false, __FUNCTION__)); + CGetSystemTimeCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_SYSTEM_TIME, true, __func__)); + CGetSystemTimeCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_SYSTEM_TIME, false, __func__)); memcpy(time, &playEndCall->m_Res, sizeof(SYSTEMTIME)); freeFuncCall(playCall); freeFuncCall(playEndCall); } void CPlayingEngExtInterceptor::GetTimeZoneInfo(LPTIME_ZONE_INFORMATION zinfo) { - CGetTimeZoneInfoCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_TIMEZONE_INFO, true, __FUNCTION__)); - CGetTimeZoneInfoCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_TIMEZONE_INFO, false, __FUNCTION__)); + CGetTimeZoneInfoCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_TIMEZONE_INFO, true, __func__)); + CGetTimeZoneInfoCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_TIMEZONE_INFO, false, __func__)); memcpy(zinfo, &playEndCall->m_Res, sizeof(TIME_ZONE_INFORMATION)); freeFuncCall(playCall); freeFuncCall(playEndCall); @@ -374,8 +374,8 @@ void CPlayingEngExtInterceptor::GetTimeZoneInfo(LPTIME_ZONE_INFORMATION zinfo) { BOOL CPlayingEngExtInterceptor::GetProcessTimes(HANDLE hProcess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime) { - CGetProcessTimesCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_PROCESS_TIMES, true, __FUNCTION__)); - CGetProcessTimesCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_PROCESS_TIMES, false, __FUNCTION__)); + CGetProcessTimesCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_PROCESS_TIMES, true, __func__)); + CGetProcessTimesCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_PROCESS_TIMES, false, __func__)); BOOL res = playEndCall->m_Res; memcpy(lpCreationTime, &playEndCall->m_CreationTime, sizeof(FILETIME)); @@ -389,8 +389,8 @@ BOOL CPlayingEngExtInterceptor::GetProcessTimes(HANDLE hProcess, LPFILETIME lpCr void CPlayingEngExtInterceptor::GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime) { - CGetSystemTimeAsFileTimeCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_SYSTEM_TIME_AS_FILE_TIME, true, __FUNCTION__)); - CGetSystemTimeAsFileTimeCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_SYSTEM_TIME_AS_FILE_TIME, false, __FUNCTION__)); + CGetSystemTimeAsFileTimeCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_SYSTEM_TIME_AS_FILE_TIME, true, __func__)); + CGetSystemTimeAsFileTimeCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_SYSTEM_TIME_AS_FILE_TIME, false, __func__)); memcpy(lpSystemTimeAsFileTime, &playEndCall->m_SystemTime, sizeof(FILETIME)); freeFuncCall(playCall); freeFuncCall(playEndCall); @@ -398,9 +398,9 @@ void CPlayingEngExtInterceptor::GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeA SOCKET CPlayingEngExtInterceptor::socket(int af, int type, int protocol) { - CSocketCall* playCall = dynamic_cast(getNextCall(false, false, ECF_SOCKET, true, __FUNCTION__)); - CSocketCall(af, type, protocol).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSocketCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_SOCKET, false, __FUNCTION__)); + CSocketCall* playCall = dynamic_cast(getNextCall(false, false, ECF_SOCKET, true, __func__)); + CSocketCall(af, type, protocol).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CSocketCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_SOCKET, false, __func__)); SOCKET res = playEndCall->m_Res; freeFuncCall(playCall); freeFuncCall(playEndCall); @@ -409,9 +409,9 @@ SOCKET CPlayingEngExtInterceptor::socket(int af, int type, int protocol) { } int CPlayingEngExtInterceptor::ioctlsocket(SOCKET s, long cmd, u_long *argp) { - CIoCtlSocketCall* playCall = dynamic_cast(getNextCall(false, false, ECF_IOCTL_SOCKET, true, __FUNCTION__)); - CIoCtlSocketCall(s, cmd, *argp).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CIoCtlSocketCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_IOCTL_SOCKET, false, __FUNCTION__)); + CIoCtlSocketCall* playCall = dynamic_cast(getNextCall(false, false, ECF_IOCTL_SOCKET, true, __func__)); + CIoCtlSocketCall(s, cmd, *argp).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CIoCtlSocketCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_IOCTL_SOCKET, false, __func__)); int res = playEndCall->m_Res; *argp = playEndCall->m_OutValue; @@ -421,9 +421,9 @@ int CPlayingEngExtInterceptor::ioctlsocket(SOCKET s, long cmd, u_long *argp) { } int CPlayingEngExtInterceptor::setsockopt(SOCKET s, int level, int optname, const char* optval, int optlen) { - CSetSockOptCall* playCall = dynamic_cast(getNextCall(false, false, ECF_SET_SOCK_OPT, true, __FUNCTION__)); - CSetSockOptCall(s, level, optname, optval, optlen).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSetSockOptCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_SET_SOCK_OPT, false, __FUNCTION__)); + CSetSockOptCall* playCall = dynamic_cast(getNextCall(false, false, ECF_SET_SOCK_OPT, true, __func__)); + CSetSockOptCall(s, level, optname, optval, optlen).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CSetSockOptCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_SET_SOCK_OPT, false, __func__)); int res = playEndCall->m_Res; freeFuncCall(playCall); freeFuncCall(playEndCall); @@ -432,9 +432,9 @@ int CPlayingEngExtInterceptor::setsockopt(SOCKET s, int level, int optname, cons } int CPlayingEngExtInterceptor::closesocket(SOCKET s) { - CCloseSocketCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CLOSE_SOCKET, true, __FUNCTION__)); - CCloseSocketCall(s).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CCloseSocketCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_CLOSE_SOCKET, false, __FUNCTION__)); + CCloseSocketCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CLOSE_SOCKET, true, __func__)); + CCloseSocketCall(s).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CCloseSocketCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_CLOSE_SOCKET, false, __func__)); int res = playEndCall->m_Res; freeFuncCall(playCall); freeFuncCall(playEndCall); @@ -443,9 +443,9 @@ int CPlayingEngExtInterceptor::closesocket(SOCKET s) { } int CPlayingEngExtInterceptor::recvfrom(SOCKET s, char* buf, int len, int flags, struct sockaddr* from, socklen_t *fromlen) { - CRecvFromCall* playCall = dynamic_cast(getNextCall(false, false, ECF_RECVFROM, true, __FUNCTION__)); - CRecvFromCall(s, len, flags, *fromlen).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CRecvFromCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_RECVFROM, false, __FUNCTION__)); + CRecvFromCall* playCall = dynamic_cast(getNextCall(false, false, ECF_RECVFROM, true, __func__)); + CRecvFromCall(s, len, flags, *fromlen).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CRecvFromCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_RECVFROM, false, __func__)); int res = playEndCall->m_Res; *fromlen = playEndCall->m_FromLenOut; @@ -464,9 +464,9 @@ int CPlayingEngExtInterceptor::recvfrom(SOCKET s, char* buf, int len, int flags, } int CPlayingEngExtInterceptor::sendto(SOCKET s, const char* buf, int len, int flags, const struct sockaddr* to, int tolen) { - CSendToCall* playCall = dynamic_cast(getNextCall(false, false, ECF_SENDTO, true, __FUNCTION__)); - CSendToCall(s, buf, len, flags, to, tolen).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSendToCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_SENDTO, false, __FUNCTION__)); + CSendToCall* playCall = dynamic_cast(getNextCall(false, false, ECF_SENDTO, true, __func__)); + CSendToCall(s, buf, len, flags, to, tolen).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CSendToCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_SENDTO, false, __func__)); int res = playEndCall->m_Res; freeFuncCall(playCall); freeFuncCall(playEndCall); @@ -475,9 +475,9 @@ int CPlayingEngExtInterceptor::sendto(SOCKET s, const char* buf, int len, int fl } int CPlayingEngExtInterceptor::bind(SOCKET s, const struct sockaddr* addr, int namelen) { - CBindCall* playCall = dynamic_cast(getNextCall(false, false, ECF_BIND, true, __FUNCTION__)); - CBindCall(s, addr, namelen).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CBindCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_BIND, false, __FUNCTION__)); + CBindCall* playCall = dynamic_cast(getNextCall(false, false, ECF_BIND, true, __func__)); + CBindCall(s, addr, namelen).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CBindCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_BIND, false, __func__)); int res = playEndCall->m_Res; freeFuncCall(playCall); freeFuncCall(playEndCall); @@ -486,9 +486,9 @@ int CPlayingEngExtInterceptor::bind(SOCKET s, const struct sockaddr* addr, int n } int CPlayingEngExtInterceptor::getsockname(SOCKET s, struct sockaddr* name, socklen_t* namelen) { - CGetSockNameCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_SOCK_NAME, true, __FUNCTION__)); - CGetSockNameCall(s, *namelen).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGetSockNameCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_SOCK_NAME, false, __FUNCTION__)); + CGetSockNameCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_SOCK_NAME, true, __func__)); + CGetSockNameCall(s, *namelen).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGetSockNameCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_SOCK_NAME, false, __func__)); int res = playEndCall->m_Res; *namelen = playEndCall->m_AddrLenOut; @@ -502,8 +502,8 @@ int CPlayingEngExtInterceptor::getsockname(SOCKET s, struct sockaddr* name, sock } int CPlayingEngExtInterceptor::WSAGetLastError() { - CWSAGetLastErrorCall* playCall = dynamic_cast(getNextCall(false, false, ECF_WSA_GET_LAST_ERROR, true, __FUNCTION__)); - CWSAGetLastErrorCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_WSA_GET_LAST_ERROR, false, __FUNCTION__)); + CWSAGetLastErrorCall* playCall = dynamic_cast(getNextCall(false, false, ECF_WSA_GET_LAST_ERROR, true, __func__)); + CWSAGetLastErrorCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_WSA_GET_LAST_ERROR, false, __func__)); int res = playEndCall->m_Res; freeFuncCall(playCall); freeFuncCall(playEndCall); @@ -512,9 +512,9 @@ int CPlayingEngExtInterceptor::WSAGetLastError() { } struct hostent* CPlayingEngExtInterceptor::gethostbyname(const char *name) { - CGetHostByNameCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_HOST_BY_NAME, true, __FUNCTION__)); - CGetHostByNameCall(name).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGetHostByNameCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_HOST_BY_NAME, false, __FUNCTION__)); + CGetHostByNameCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_HOST_BY_NAME, true, __func__)); + CGetHostByNameCall(name).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGetHostByNameCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_HOST_BY_NAME, false, __func__)); setCurrentHostent(&playEndCall->m_HostentData); @@ -524,9 +524,9 @@ struct hostent* CPlayingEngExtInterceptor::gethostbyname(const char *name) { } int CPlayingEngExtInterceptor::gethostname(char *name, int namelen) { - CGetHostNameCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_HOST_NAME, true, __FUNCTION__)); - CGetHostNameCall(namelen).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGetHostNameCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_HOST_NAME, false, __FUNCTION__)); + CGetHostNameCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_HOST_NAME, true, __func__)); + CGetHostNameCall(namelen).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGetHostNameCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_HOST_NAME, false, __func__)); int res = playEndCall->m_Res; strcpy(name, playEndCall->m_Name); @@ -560,9 +560,9 @@ void CPlayingEngExtInterceptor::setCurrentTm(struct tm* t) { } void CPlayingEngExtInterceptor::SteamAPI_SetBreakpadAppID(uint32 unAppID) { - CSteamApiSetBreakpadAppIdCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_SET_BREAKPAD_APP_ID, true, __FUNCTION__)); - CSteamApiSetBreakpadAppIdCall(unAppID).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSteamApiSetBreakpadAppIdCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_SET_BREAKPAD_APP_ID, false, __FUNCTION__)); + CSteamApiSetBreakpadAppIdCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_SET_BREAKPAD_APP_ID, true, __func__)); + CSteamApiSetBreakpadAppIdCall(unAppID).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CSteamApiSetBreakpadAppIdCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_SET_BREAKPAD_APP_ID, false, __func__)); freeFuncCall(playCall); freeFuncCall(playEndCall); } @@ -574,9 +574,9 @@ void CPlayingEngExtInterceptor::SteamAPI_UseBreakpadCrashHandler(char const *pch void CPlayingEngExtInterceptor::SteamAPI_RegisterCallback(CCallbackBase *pCallback, int iCallback) { int rehldsId = getOrRegisterSteamCallback(pCallback); - CSteamApiRegisterCallbackCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_REGISTER_CALLBACK, true, __FUNCTION__)); - CSteamApiRegisterCallbackCall(rehldsId, iCallback, pCallback).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSteamApiRegisterCallbackCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_REGISTER_CALLBACK, false, __FUNCTION__)); + CSteamApiRegisterCallbackCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_REGISTER_CALLBACK, true, __func__)); + CSteamApiRegisterCallbackCall(rehldsId, iCallback, pCallback).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CSteamApiRegisterCallbackCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_REGISTER_CALLBACK, false, __func__)); pCallback->SetFlags(playEndCall->m_OutState.m_nCallbackFlags); pCallback->SetICallback(playEndCall->m_OutState.m_iCallback); @@ -584,8 +584,8 @@ void CPlayingEngExtInterceptor::SteamAPI_RegisterCallback(CCallbackBase *pCallba } bool CPlayingEngExtInterceptor::SteamAPI_Init() { - CSteamApiInitCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_INIT, true, __FUNCTION__)); - CSteamApiInitCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_INIT, false, __FUNCTION__)); + CSteamApiInitCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_INIT, true, __func__)); + CSteamApiInitCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_INIT, false, __func__)); bool res = playEndCall->m_Res; freeFuncCall(playCall); freeFuncCall(playEndCall); @@ -596,9 +596,9 @@ bool CPlayingEngExtInterceptor::SteamAPI_Init() { void CPlayingEngExtInterceptor::SteamAPI_UnregisterCallResult(class CCallbackBase *pCallback, SteamAPICall_t hAPICall) { int rehldsId = getOrRegisterSteamCallback(pCallback); - CSteamApiUnrigestierCallResultCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_UNREGISTER_CALL_RESULT, true, __FUNCTION__)); - CSteamApiUnrigestierCallResultCall(rehldsId, hAPICall, pCallback).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSteamApiUnrigestierCallResultCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_UNREGISTER_CALL_RESULT, false, __FUNCTION__)); + CSteamApiUnrigestierCallResultCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_UNREGISTER_CALL_RESULT, true, __func__)); + CSteamApiUnrigestierCallResultCall(rehldsId, hAPICall, pCallback).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CSteamApiUnrigestierCallResultCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_UNREGISTER_CALL_RESULT, false, __func__)); pCallback->SetFlags(playEndCall->m_OutState.m_nCallbackFlags); pCallback->SetICallback(playEndCall->m_OutState.m_iCallback); @@ -606,8 +606,8 @@ void CPlayingEngExtInterceptor::SteamAPI_UnregisterCallResult(class CCallbackBas } ISteamApps* CPlayingEngExtInterceptor::SteamApps() { - CSteamAppsCall* playCall = (CSteamAppsCall*)getNextCall(false, false, ECF_STEAMAPPS, true, __FUNCTION__); - CSteamAppsCall* playEndCall = (CSteamAppsCall*)getNextCall(false, true, ECF_STEAMAPPS, false, __FUNCTION__); + CSteamAppsCall* playCall = (CSteamAppsCall*)getNextCall(false, false, ECF_STEAMAPPS, true, __func__); + CSteamAppsCall* playEndCall = (CSteamAppsCall*)getNextCall(false, true, ECF_STEAMAPPS, false, __func__); ISteamApps* res = NULL; if (!playEndCall->m_ReturnNull) { @@ -620,9 +620,9 @@ ISteamApps* CPlayingEngExtInterceptor::SteamApps() { } bool CPlayingEngExtInterceptor::SteamGameServer_Init(uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString) { - CSteamGameServerInitCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAMGAMESERVER_INIT, true, __FUNCTION__)); - CSteamGameServerInitCall(unIP, usSteamPort, usGamePort, usQueryPort, eServerMode, pchVersionString).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSteamGameServerInitCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAMGAMESERVER_INIT, false, __FUNCTION__)); + CSteamGameServerInitCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAMGAMESERVER_INIT, true, __func__)); + CSteamGameServerInitCall(unIP, usSteamPort, usGamePort, usQueryPort, eServerMode, pchVersionString).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CSteamGameServerInitCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAMGAMESERVER_INIT, false, __func__)); bool res = playEndCall->m_Res; freeFuncCall(playCall); freeFuncCall(playEndCall); @@ -631,8 +631,8 @@ bool CPlayingEngExtInterceptor::SteamGameServer_Init(uint32 unIP, uint16 usSteam } ISteamGameServer* CPlayingEngExtInterceptor::SteamGameServer() { - CSteamGameServerCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAMGAMESERVER, true, __FUNCTION__)); - CSteamGameServerCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAMGAMESERVER, false, __FUNCTION__)); + CSteamGameServerCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAMGAMESERVER, true, __func__)); + CSteamGameServerCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAMGAMESERVER, false, __func__)); ISteamGameServer* res = NULL; if (!playEndCall->m_ReturnNull) { @@ -645,23 +645,23 @@ ISteamGameServer* CPlayingEngExtInterceptor::SteamGameServer() { } void CPlayingEngExtInterceptor::SteamGameServer_RunCallbacks() { - CSteamGameServerRunCallbacksCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAMGAMESERVER_RUN_CALLBACKS, true, __FUNCTION__)); - CSteamGameServerRunCallbacksCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAMGAMESERVER_RUN_CALLBACKS, false, __FUNCTION__)); + CSteamGameServerRunCallbacksCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAMGAMESERVER_RUN_CALLBACKS, true, __func__)); + CSteamGameServerRunCallbacksCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAMGAMESERVER_RUN_CALLBACKS, false, __func__)); freeFuncCall(playCall); freeFuncCall(playEndCall); } void CPlayingEngExtInterceptor::SteamAPI_RunCallbacks() { - CSteamApiRunCallbacksCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_RUN_CALLBACKS, true, __FUNCTION__)); - CSteamApiRunCallbacksCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_RUN_CALLBACKS, false, __FUNCTION__)); + CSteamApiRunCallbacksCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_RUN_CALLBACKS, true, __func__)); + CSteamApiRunCallbacksCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_RUN_CALLBACKS, false, __func__)); freeFuncCall(playCall); freeFuncCall(playEndCall); } void CPlayingEngExtInterceptor::SteamGameServer_Shutdown() { - CSteamGameServerShutdownCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAMGAMESERVER_SHUTDOWN, true, __FUNCTION__)); - CSteamGameServerShutdownCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAMGAMESERVER_SHUTDOWN, false, __FUNCTION__)); + CSteamGameServerShutdownCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAMGAMESERVER_SHUTDOWN, true, __func__)); + CSteamGameServerShutdownCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAMGAMESERVER_SHUTDOWN, false, __func__)); freeFuncCall(playCall); freeFuncCall(playEndCall); } @@ -670,9 +670,9 @@ void CPlayingEngExtInterceptor::SteamGameServer_Shutdown() void CPlayingEngExtInterceptor::SteamAPI_UnregisterCallback(CCallbackBase *pCallback) { int rehldsId = getOrRegisterSteamCallback(pCallback); - CSteamApiUnregisterCallbackCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_UNREGISTER_CALLBACK, true, __FUNCTION__)); - CSteamApiUnregisterCallbackCall(rehldsId, pCallback).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSteamApiUnregisterCallbackCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_UNREGISTER_CALLBACK, false, __FUNCTION__)); + CSteamApiUnregisterCallbackCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_UNREGISTER_CALLBACK, true, __func__)); + CSteamApiUnregisterCallbackCall(rehldsId, pCallback).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CSteamApiUnregisterCallbackCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_UNREGISTER_CALLBACK, false, __func__)); pCallback->SetFlags(playEndCall->m_OutState.m_nCallbackFlags); pCallback->SetICallback(playEndCall->m_OutState.m_iCallback); @@ -689,63 +689,63 @@ CSteamGameServerPlayingWrapper::CSteamGameServerPlayingWrapper(CPlayingEngExtInt } bool CSteamGameServerPlayingWrapper::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; } void CSteamGameServerPlayingWrapper::SetProduct(const char *pszProduct) { - CGameServerSetProductCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_PRODUCT, true, __FUNCTION__)); - CGameServerSetProductCall(pszProduct).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetProductCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_PRODUCT, false, __FUNCTION__)); + CGameServerSetProductCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_PRODUCT, true, __func__)); + CGameServerSetProductCall(pszProduct).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGameServerSetProductCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_PRODUCT, false, __func__)); m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); } void CSteamGameServerPlayingWrapper::SetGameDescription(const char *pszGameDescription) { - CGameServerSetGameDescCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_GAME_DESC, true, __FUNCTION__)); - CGameServerSetGameDescCall(pszGameDescription).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetGameDescCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_GAME_DESC, false, __FUNCTION__)); + CGameServerSetGameDescCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_GAME_DESC, true, __func__)); + CGameServerSetGameDescCall(pszGameDescription).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGameServerSetGameDescCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_GAME_DESC, false, __func__)); m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); } void CSteamGameServerPlayingWrapper::SetModDir(const char *pszModDir) { - CGameServerSetModDirCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_GAME_DIR, true, __FUNCTION__)); - CGameServerSetModDirCall(pszModDir).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetModDirCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_GAME_DIR, false, __FUNCTION__)); + CGameServerSetModDirCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_GAME_DIR, true, __func__)); + CGameServerSetModDirCall(pszModDir).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGameServerSetModDirCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_GAME_DIR, false, __func__)); m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); } void CSteamGameServerPlayingWrapper::SetDedicatedServer(bool bDedicated) { - CGameServerSetDedicatedServerCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_DEDICATED_SERVER, true, __FUNCTION__)); - CGameServerSetDedicatedServerCall(bDedicated).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetDedicatedServerCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_DEDICATED_SERVER, false, __FUNCTION__)); + CGameServerSetDedicatedServerCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_DEDICATED_SERVER, true, __func__)); + CGameServerSetDedicatedServerCall(bDedicated).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGameServerSetDedicatedServerCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_DEDICATED_SERVER, false, __func__)); m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); } void CSteamGameServerPlayingWrapper::LogOn(const char *pszAccountName, const char *pszPassword) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamGameServerPlayingWrapper::LogOnAnonymous() { - CGameServerLogOnAnonymousCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_LOG_ON_ANONYMOUS, true, __FUNCTION__)); - CGameServerLogOnAnonymousCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_LOG_ON_ANONYMOUS, false, __FUNCTION__)); + CGameServerLogOnAnonymousCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_LOG_ON_ANONYMOUS, true, __func__)); + CGameServerLogOnAnonymousCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_LOG_ON_ANONYMOUS, false, __func__)); m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); } void CSteamGameServerPlayingWrapper::LogOff() { - CGameServerLogOffCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_LOGOFF, true, __FUNCTION__)); - CGameServerLogOffCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_LOGOFF, false, __FUNCTION__)); + CGameServerLogOffCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_LOGOFF, true, __func__)); + CGameServerLogOffCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_LOGOFF, false, __func__)); m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); } bool CSteamGameServerPlayingWrapper::BLoggedOn() { - CGameServerBLoggedOnCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_BLOGGEDON, true, __FUNCTION__)); - CGameServerBLoggedOnCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_BLOGGEDON, false, __FUNCTION__)); + CGameServerBLoggedOnCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_BLOGGEDON, true, __func__)); + CGameServerBLoggedOnCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_BLOGGEDON, false, __func__)); bool res = playEndCall->m_Res; m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); @@ -754,8 +754,8 @@ bool CSteamGameServerPlayingWrapper::BLoggedOn() { } bool CSteamGameServerPlayingWrapper::BSecure() { - CGameServerBSecureCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_BSECURE, true, __FUNCTION__)); - CGameServerBSecureCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_BSECURE, false, __FUNCTION__)); + CGameServerBSecureCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_BSECURE, true, __func__)); + CGameServerBSecureCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_BSECURE, false, __func__)); bool res = playEndCall->m_Res; m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); @@ -764,8 +764,8 @@ bool CSteamGameServerPlayingWrapper::BSecure() { } CSteamID CSteamGameServerPlayingWrapper::GetSteamID() { - CGameServerGetSteamIdCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_GET_STEAM_ID, true, __FUNCTION__)); - CGameServerGetSteamIdCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_GET_STEAM_ID, false, __FUNCTION__)); + CGameServerGetSteamIdCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_GET_STEAM_ID, true, __func__)); + CGameServerGetSteamIdCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_GET_STEAM_ID, false, __func__)); CSteamID res(playEndCall->m_SteamId); m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); @@ -774,8 +774,8 @@ CSteamID CSteamGameServerPlayingWrapper::GetSteamID() { } bool CSteamGameServerPlayingWrapper::WasRestartRequested() { - CGameServerWasRestartRequestedCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_WAS_RESTART_REQUESTED, true, __FUNCTION__)); - CGameServerWasRestartRequestedCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_WAS_RESTART_REQUESTED, false, __FUNCTION__)); + CGameServerWasRestartRequestedCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_WAS_RESTART_REQUESTED, true, __func__)); + CGameServerWasRestartRequestedCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_WAS_RESTART_REQUESTED, false, __func__)); bool res = playEndCall->m_Result; m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); @@ -784,84 +784,84 @@ bool CSteamGameServerPlayingWrapper::WasRestartRequested() { } void CSteamGameServerPlayingWrapper::SetMaxPlayerCount(int cPlayersMax) { - CGameServerSetMaxPlayersCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_MAX_PLAYERS_COUNT, true, __FUNCTION__)); - CGameServerSetMaxPlayersCall(cPlayersMax).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetMaxPlayersCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_MAX_PLAYERS_COUNT, false, __FUNCTION__)); + CGameServerSetMaxPlayersCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_MAX_PLAYERS_COUNT, true, __func__)); + CGameServerSetMaxPlayersCall(cPlayersMax).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGameServerSetMaxPlayersCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_MAX_PLAYERS_COUNT, false, __func__)); m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); } void CSteamGameServerPlayingWrapper::SetBotPlayerCount(int cBotplayers) { - CGameServerSetBotCountCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_BOT_PLAYERS_COUNT, true, __FUNCTION__)); - CGameServerSetBotCountCall(cBotplayers).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetBotCountCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_BOT_PLAYERS_COUNT, false, __FUNCTION__)); + CGameServerSetBotCountCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_BOT_PLAYERS_COUNT, true, __func__)); + CGameServerSetBotCountCall(cBotplayers).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGameServerSetBotCountCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_BOT_PLAYERS_COUNT, false, __func__)); m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); } void CSteamGameServerPlayingWrapper::SetServerName(const char *pszServerName) { - CGameServerSetServerNameCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_SERVER_NAME, true, __FUNCTION__)); - CGameServerSetServerNameCall(pszServerName).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetServerNameCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_SERVER_NAME, false, __FUNCTION__)); + CGameServerSetServerNameCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_SERVER_NAME, true, __func__)); + CGameServerSetServerNameCall(pszServerName).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGameServerSetServerNameCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_SERVER_NAME, false, __func__)); m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); } void CSteamGameServerPlayingWrapper::SetMapName(const char *pszMapName) { - CGameServerSetMapNameCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_MAP_NAME, true, __FUNCTION__)); - CGameServerSetMapNameCall(pszMapName).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetMapNameCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_MAP_NAME, false, __FUNCTION__)); + CGameServerSetMapNameCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_MAP_NAME, true, __func__)); + CGameServerSetMapNameCall(pszMapName).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGameServerSetMapNameCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_MAP_NAME, false, __func__)); m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); } void CSteamGameServerPlayingWrapper::SetPasswordProtected(bool bPasswordProtected) { - CGameServerSetPasswordProtectedCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_PASSWORD_PROTECTED, true, __FUNCTION__)); - CGameServerSetPasswordProtectedCall(bPasswordProtected).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetPasswordProtectedCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_PASSWORD_PROTECTED, false, __FUNCTION__)); + CGameServerSetPasswordProtectedCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_PASSWORD_PROTECTED, true, __func__)); + CGameServerSetPasswordProtectedCall(bPasswordProtected).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGameServerSetPasswordProtectedCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_PASSWORD_PROTECTED, false, __func__)); m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); } void CSteamGameServerPlayingWrapper::SetSpectatorPort(uint16 unSpectatorPort) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamGameServerPlayingWrapper::SetSpectatorServerName(const char *pszSpectatorServerName) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamGameServerPlayingWrapper::ClearAllKeyValues() { - CGameServerClearAllKVsCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_CLEAR_ALL_KEY_VALUES, true, __FUNCTION__)); - CGameServerClearAllKVsCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_CLEAR_ALL_KEY_VALUES, false, __FUNCTION__)); + CGameServerClearAllKVsCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_CLEAR_ALL_KEY_VALUES, true, __func__)); + CGameServerClearAllKVsCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_CLEAR_ALL_KEY_VALUES, false, __func__)); m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); } void CSteamGameServerPlayingWrapper::SetKeyValue(const char *pKey, const char *pValue) { - CGameServerSetKeyValueCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_KEY_VALUE, true, __FUNCTION__)); - CGameServerSetKeyValueCall(pKey, pValue).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetKeyValueCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_KEY_VALUE, false, __FUNCTION__)); + CGameServerSetKeyValueCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_KEY_VALUE, true, __func__)); + CGameServerSetKeyValueCall(pKey, pValue).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGameServerSetKeyValueCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_KEY_VALUE, false, __func__)); m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); } void CSteamGameServerPlayingWrapper::SetGameTags(const char *pchGameTags) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamGameServerPlayingWrapper::SetGameData(const char *pchGameData) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamGameServerPlayingWrapper::SetRegion(const char *pszRegion) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } bool CSteamGameServerPlayingWrapper::SendUserConnectAndAuthenticate(uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser) { - CGameServerSendUserConnectAndAuthenticateCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SEND_USER_CONNECT_AND_AUTHENTICATE, true, __FUNCTION__)); - CGameServerSendUserConnectAndAuthenticateCall(unIPClient, pvAuthBlob, cubAuthBlobSize).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSendUserConnectAndAuthenticateCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SEND_USER_CONNECT_AND_AUTHENTICATE, false, __FUNCTION__)); + CGameServerSendUserConnectAndAuthenticateCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SEND_USER_CONNECT_AND_AUTHENTICATE, true, __func__)); + CGameServerSendUserConnectAndAuthenticateCall(unIPClient, pvAuthBlob, cubAuthBlobSize).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGameServerSendUserConnectAndAuthenticateCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SEND_USER_CONNECT_AND_AUTHENTICATE, false, __func__)); bool res = playEndCall->m_Res; *pSteamIDUser = CSteamID(playEndCall->m_OutSteamId); @@ -871,8 +871,8 @@ bool CSteamGameServerPlayingWrapper::SendUserConnectAndAuthenticate(uint32 unIPC } CSteamID CSteamGameServerPlayingWrapper::CreateUnauthenticatedUserConnection() { - CGameServerCreateUnauthUserConnectionCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_CREATE_UNAUTH_USER_CONNECTION, true, __FUNCTION__)); - CGameServerCreateUnauthUserConnectionCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_CREATE_UNAUTH_USER_CONNECTION, false, __FUNCTION__)); + CGameServerCreateUnauthUserConnectionCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_CREATE_UNAUTH_USER_CONNECTION, true, __func__)); + CGameServerCreateUnauthUserConnectionCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_CREATE_UNAUTH_USER_CONNECTION, false, __func__)); CSteamID res = playEndCall->m_SteamId; m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); @@ -881,17 +881,17 @@ CSteamID CSteamGameServerPlayingWrapper::CreateUnauthenticatedUserConnection() { } void CSteamGameServerPlayingWrapper::SendUserDisconnect(CSteamID steamIDUser) { - CGameServerSendUserDisconnectCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SEND_USER_DISCONNECT, true, __FUNCTION__)); - CGameServerSendUserDisconnectCall(steamIDUser).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSendUserDisconnectCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SEND_USER_DISCONNECT, false, __FUNCTION__)); + CGameServerSendUserDisconnectCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SEND_USER_DISCONNECT, true, __func__)); + CGameServerSendUserDisconnectCall(steamIDUser).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGameServerSendUserDisconnectCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SEND_USER_DISCONNECT, false, __func__)); m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); } bool CSteamGameServerPlayingWrapper::BUpdateUserData(CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore) { - CGameServerBUpdateUserDataCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_BUPDATE_USER_DATA, true, __FUNCTION__)); - CGameServerBUpdateUserDataCall(steamIDUser, pchPlayerName, uScore).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerBUpdateUserDataCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_BUPDATE_USER_DATA, false, __FUNCTION__)); + CGameServerBUpdateUserDataCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_BUPDATE_USER_DATA, true, __func__)); + CGameServerBUpdateUserDataCall(steamIDUser, pchPlayerName, uScore).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGameServerBUpdateUserDataCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_BUPDATE_USER_DATA, false, __func__)); bool res = playEndCall->m_Res; m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); @@ -900,51 +900,51 @@ bool CSteamGameServerPlayingWrapper::BUpdateUserData(CSteamID steamIDUser, const } HAuthTicket CSteamGameServerPlayingWrapper::GetAuthSessionTicket(void *pTicket, int cbMaxTicket, uint32 *pcbTicket) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return k_HAuthTicketInvalid; } EBeginAuthSessionResult CSteamGameServerPlayingWrapper::BeginAuthSession(const void *pAuthTicket, int cbAuthTicket, CSteamID steamID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return k_EBeginAuthSessionResultInvalidTicket; } void CSteamGameServerPlayingWrapper::EndAuthSession(CSteamID steamID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamGameServerPlayingWrapper::CancelAuthTicket(HAuthTicket hAuthTicket) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } EUserHasLicenseForAppResult CSteamGameServerPlayingWrapper::UserHasLicenseForApp(CSteamID steamID, AppId_t appID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return k_EUserHasLicenseResultHasLicense; } bool CSteamGameServerPlayingWrapper::RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } void CSteamGameServerPlayingWrapper::GetGameplayStats() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } SteamAPICall_t CSteamGameServerPlayingWrapper::GetServerReputation() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return k_uAPICallInvalid; } uint32 CSteamGameServerPlayingWrapper::GetPublicIP() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return 0; } bool CSteamGameServerPlayingWrapper::HandleIncomingPacket(const void *pData, int cbData, uint32 srcIP, uint16 srcPort) { - CGameServerHandleIncomingPacketCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_HANDLE_INCOMING_PACKET, true, __FUNCTION__)); - CGameServerHandleIncomingPacketCall(pData, cbData, srcIP, srcPort).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerHandleIncomingPacketCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_HANDLE_INCOMING_PACKET, false, __FUNCTION__)); + CGameServerHandleIncomingPacketCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_HANDLE_INCOMING_PACKET, true, __func__)); + CGameServerHandleIncomingPacketCall(pData, cbData, srcIP, srcPort).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGameServerHandleIncomingPacketCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_HANDLE_INCOMING_PACKET, false, __func__)); bool res = playEndCall->m_Res; m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); @@ -953,9 +953,9 @@ bool CSteamGameServerPlayingWrapper::HandleIncomingPacket(const void *pData, int } int CSteamGameServerPlayingWrapper::GetNextOutgoingPacket(void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort) { - CGameServerGetNextOutgoingPacketCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_GET_NEXT_OUTGOING_PACKET, true, __FUNCTION__)); - CGameServerGetNextOutgoingPacketCall(cbMaxOut).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerGetNextOutgoingPacketCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_GET_NEXT_OUTGOING_PACKET, false, __FUNCTION__)); + CGameServerGetNextOutgoingPacketCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_GET_NEXT_OUTGOING_PACKET, true, __func__)); + CGameServerGetNextOutgoingPacketCall(cbMaxOut).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGameServerGetNextOutgoingPacketCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_GET_NEXT_OUTGOING_PACKET, false, __func__)); int res = playEndCall->m_Result; *pNetAdr = playEndCall->m_Addr; @@ -967,32 +967,32 @@ int CSteamGameServerPlayingWrapper::GetNextOutgoingPacket(void *pOut, int cbMaxO } void CSteamGameServerPlayingWrapper::EnableHeartbeats(bool bActive) { - CGameServerEnableHeartbeatsCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_ENABLE_HEARTBEATS, true, __FUNCTION__)); - CGameServerEnableHeartbeatsCall(bActive).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerEnableHeartbeatsCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_ENABLE_HEARTBEATS, false, __FUNCTION__)); + CGameServerEnableHeartbeatsCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_ENABLE_HEARTBEATS, true, __func__)); + CGameServerEnableHeartbeatsCall(bActive).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGameServerEnableHeartbeatsCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_ENABLE_HEARTBEATS, false, __func__)); m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); } void CSteamGameServerPlayingWrapper::SetHeartbeatInterval(int iHeartbeatInterval) { - CGameServerSetHeartbeatIntervalCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_HEARTBEATS_INTERVAL, true, __FUNCTION__)); - CGameServerSetHeartbeatIntervalCall(iHeartbeatInterval).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetHeartbeatIntervalCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_HEARTBEATS_INTERVAL, false, __FUNCTION__)); + CGameServerSetHeartbeatIntervalCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_HEARTBEATS_INTERVAL, true, __func__)); + CGameServerSetHeartbeatIntervalCall(iHeartbeatInterval).ensureArgsAreEqual(playCall, m_bStrictChecks, __func__); + CGameServerSetHeartbeatIntervalCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_HEARTBEATS_INTERVAL, false, __func__)); m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); } void CSteamGameServerPlayingWrapper::ForceHeartbeat() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } SteamAPICall_t CSteamGameServerPlayingWrapper::AssociateWithClan(CSteamID steamIDClan) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return k_uAPICallInvalid; } SteamAPICall_t CSteamGameServerPlayingWrapper::ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return k_uAPICallInvalid; } @@ -1008,93 +1008,93 @@ CSteamAppsPlayingWrapper::CSteamAppsPlayingWrapper(CPlayingEngExtInterceptor* pl } bool CSteamAppsPlayingWrapper::BIsSubscribed() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } bool CSteamAppsPlayingWrapper::BIsLowViolence() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } bool CSteamAppsPlayingWrapper::BIsCybercafe() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } bool CSteamAppsPlayingWrapper::BIsVACBanned() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } const char* CSteamAppsPlayingWrapper::GetCurrentGameLanguage() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return ""; } const char* CSteamAppsPlayingWrapper::GetAvailableGameLanguages() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return ""; } bool CSteamAppsPlayingWrapper::BIsSubscribedApp(AppId_t appID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } bool CSteamAppsPlayingWrapper::BIsDlcInstalled(AppId_t appID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } uint32 CSteamAppsPlayingWrapper::GetEarliestPurchaseUnixTime(AppId_t nAppID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return 0; } bool CSteamAppsPlayingWrapper::BIsSubscribedFromFreeWeekend() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } int CSteamAppsPlayingWrapper::GetDLCCount() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return 0; } bool CSteamAppsPlayingWrapper::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; } void CSteamAppsPlayingWrapper::InstallDLC(AppId_t nAppID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamAppsPlayingWrapper::UninstallDLC(AppId_t nAppID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamAppsPlayingWrapper::RequestAppProofOfPurchaseKey(AppId_t nAppID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } bool CSteamAppsPlayingWrapper::GetCurrentBetaName(char *pchName, int cchNameBufferSize) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } bool CSteamAppsPlayingWrapper::MarkContentCorrupt(bool bMissingFilesOnly) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } uint32 CSteamAppsPlayingWrapper::GetInstalledDepots(DepotId_t *pvecDepots, uint32 cMaxDepots) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return 0; } uint32 CSteamAppsPlayingWrapper::GetAppInstallDir(AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return 0; } diff --git a/rehlds/testsuite/recorder.cpp b/rehlds/testsuite/recorder.cpp index c0eb676..368f22b 100644 --- a/rehlds/testsuite/recorder.cpp +++ b/rehlds/testsuite/recorder.cpp @@ -19,8 +19,8 @@ CSteamCallbackRecordingWrapper::CSteamCallbackRecordingWrapper(CRecordingEngExtI void CSteamCallbackRecordingWrapper::Run(void *pvParam) { - if (m_Wrapped->GetICallback() != this->GetICallback()) rehlds_syserror("%s: iCallback desync", __FUNCTION__); - if (m_Wrapped->GetFlags() != this->GetFlags()) rehlds_syserror("%s: flags 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", __func__); CSteamCallbackCall1 fcall(m_Id, pvParam, m_Size, m_Wrapped); CRecorderFuncCall frec(&fcall); m_Recorder->PushFunc(&frec); @@ -33,8 +33,8 @@ void CSteamCallbackRecordingWrapper::Run(void *pvParam) 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->GetFlags() != this->GetFlags()) rehlds_syserror("%s: flags 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", __func__); CSteamCallbackCall2 fcall(m_Id, pvParam, m_Size, bIOFailure, hSteamAPICall, m_Wrapped); CRecorderFuncCall frec(&fcall); m_Recorder->PushFunc(&frec); @@ -61,25 +61,25 @@ CSteamAppsRecordingWrapper::CSteamAppsRecordingWrapper(ISteamApps* original, CRe bool CSteamAppsRecordingWrapper::BIsSubscribed() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } bool CSteamAppsRecordingWrapper::BIsLowViolence() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } bool CSteamAppsRecordingWrapper::BIsCybercafe() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } bool CSteamAppsRecordingWrapper::BIsVACBanned() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } @@ -95,82 +95,82 @@ const char* CSteamAppsRecordingWrapper::GetCurrentGameLanguage() const char* CSteamAppsRecordingWrapper::GetAvailableGameLanguages() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return NULL; } bool CSteamAppsRecordingWrapper::BIsSubscribedApp(AppId_t appID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } bool CSteamAppsRecordingWrapper::BIsDlcInstalled(AppId_t appID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } uint32 CSteamAppsRecordingWrapper::GetEarliestPurchaseUnixTime(AppId_t nAppID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return 0; } bool CSteamAppsRecordingWrapper::BIsSubscribedFromFreeWeekend() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } int CSteamAppsRecordingWrapper::GetDLCCount() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return 0; } 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; } void CSteamAppsRecordingWrapper::InstallDLC(AppId_t nAppID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamAppsRecordingWrapper::UninstallDLC(AppId_t nAppID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } 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) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } bool CSteamAppsRecordingWrapper::MarkContentCorrupt(bool bMissingFilesOnly) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } uint32 CSteamAppsRecordingWrapper::GetInstalledDepots(DepotId_t *pvecDepots, uint32 cMaxDepots) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return 0; } uint32 CSteamAppsRecordingWrapper::GetAppInstallDir(AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); 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) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } @@ -221,7 +221,7 @@ void CSteamGameServerRecordingWrapper::SetDedicatedServer(bool bDedicated) void CSteamGameServerRecordingWrapper::LogOn(const char *pszAccountName, const char *pszPassword) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamGameServerRecordingWrapper::LogOnAnonymous() @@ -322,12 +322,12 @@ void CSteamGameServerRecordingWrapper::SetPasswordProtected(bool bPasswordProtec void CSteamGameServerRecordingWrapper::SetSpectatorPort(uint16 unSpectatorPort) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamGameServerRecordingWrapper::SetSpectatorServerName(const char *pszSpectatorServerName) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamGameServerRecordingWrapper::ClearAllKeyValues() @@ -348,17 +348,17 @@ void CSteamGameServerRecordingWrapper::SetKeyValue(const char *pKey, const char void CSteamGameServerRecordingWrapper::SetGameTags(const char *pchGameTags) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } void CSteamGameServerRecordingWrapper::SetGameData(const char *pchGameData) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } 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) @@ -401,52 +401,52 @@ bool CSteamGameServerRecordingWrapper::BUpdateUserData(CSteamID steamIDUser, con HAuthTicket CSteamGameServerRecordingWrapper::GetAuthSessionTicket(void *pTicket, int cbMaxTicket, uint32 *pcbTicket) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return k_HAuthTicketInvalid; } 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; } void CSteamGameServerRecordingWrapper::EndAuthSession(CSteamID steamID) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } 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) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return k_EUserHasLicenseResultDoesNotHaveLicense; } bool CSteamGameServerRecordingWrapper::RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return false; } void CSteamGameServerRecordingWrapper::GetGameplayStats() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } SteamAPICall_t CSteamGameServerRecordingWrapper::GetServerReputation() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return k_uAPICallInvalid; } uint32 CSteamGameServerRecordingWrapper::GetPublicIP() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return 0; } @@ -488,18 +488,18 @@ void CSteamGameServerRecordingWrapper::SetHeartbeatInterval(int iHeartbeatInterv void CSteamGameServerRecordingWrapper::ForceHeartbeat() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } SteamAPICall_t CSteamGameServerRecordingWrapper::AssociateWithClan(CSteamID steamIDClan) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return k_uAPICallInvalid; } SteamAPICall_t CSteamGameServerRecordingWrapper::ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return k_uAPICallInvalid; } @@ -574,7 +574,7 @@ void CRecordingEngExtInterceptor::PushFunc(CRecorderFuncCall* func) void CRecordingEngExtInterceptor::PopFunc(CRecorderFuncCall* func) { if (func != m_LastFunc) - rehlds_syserror("%s: stack corrupted", __FUNCTION__); + rehlds_syserror("%s: stack corrupted", __func__); writeCall(!func->m_StartWritten, true, func->m_FuncCall); if (m_LastFunc->m_Prev == NULL) { @@ -842,8 +842,8 @@ void CRecordingEngExtInterceptor::SteamAPI_RegisterCallback(CCallbackBase *pCall { CSteamCallbackRecordingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback); - if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __FUNCTION__); - //if (wrappee->GetICallback() != pCallback->GetICallback()) 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", __func__); CSteamApiRegisterCallbackCall fcall(wrappee->getRehldsCallbackId(), iCallback, wrappee); CRecorderFuncCall frec(&fcall); PushFunc(&frec); @@ -870,8 +870,8 @@ void CRecordingEngExtInterceptor::SteamAPI_UnregisterCallResult(class CCallbackB { CSteamCallbackRecordingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback); - if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __FUNCTION__); - if (wrappee->GetICallback() != pCallback->GetICallback()) 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", __func__); CSteamApiUnrigestierCallResultCall fcall(wrappee->getRehldsCallbackId(), hAPICall, wrappee); CRecorderFuncCall frec(&fcall); @@ -981,8 +981,8 @@ void CRecordingEngExtInterceptor::SteamAPI_UnregisterCallback(CCallbackBase *pCa { CSteamCallbackRecordingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback); - if (wrappee->GetFlags() != pCallback->GetFlags()) rehlds_syserror("%s: flags desync", __FUNCTION__); - if (wrappee->GetICallback() != pCallback->GetICallback()) 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", __func__); CSteamApiUnregisterCallbackCall fcall(wrappee->getRehldsCallbackId(), wrappee); CRecorderFuncCall frec(&fcall); PushFunc(&frec); diff --git a/rehlds/testsuite/testsuite.cpp b/rehlds/testsuite/testsuite.cpp index 284618a..90c9b2b 100644 --- a/rehlds/testsuite/testsuite.cpp +++ b/rehlds/testsuite/testsuite.cpp @@ -12,7 +12,7 @@ uint32 __cdecl time_hooked(uint32* pTime) struct tm* __cdecl localtime_hooked(uint32* pTime) { if (pTime == NULL) - rehlds_syserror("%s: pTime is NULL", __FUNCTION__); + rehlds_syserror("%s: pTime is NULL", __func__); 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) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } 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) @@ -144,13 +144,13 @@ bool __cdecl SteamAPI_Init_hooked() ISteamUser* __cdecl SteamUser_hooked() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return NULL; } ISteamFriends* __cdecl SteamFriends_hooked() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return NULL; } @@ -161,7 +161,7 @@ void __cdecl SteamGameServer_RunCallbacks_hooked() void __cdecl SteamAPI_Shutdown_hooked() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } 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) { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); } ISteamHTTP* __cdecl SteamHTTP_hooked() { - rehlds_syserror("%s: not implemented", __FUNCTION__); + rehlds_syserror("%s: not implemented", __func__); return NULL; } diff --git a/shared.gradle b/shared.gradle index b251219..ec81f33 100644 --- a/shared.gradle +++ b/shared.gradle @@ -8,26 +8,29 @@ import org.gradle.nativeplatform.toolchain.VisualCpp apply from: 'shared_msvc.gradle' apply from: 'shared_icc.gradle' +apply from: 'shared_gcc.gradle' rootProject.ext.createToolchainConfig = { NativeBinarySpec bin -> - BinaryKind binaryKind - if (bin instanceof NativeExecutableBinarySpec) { - binaryKind = BinaryKind.EXECUTABLE - } else if (bin instanceof SharedLibraryBinarySpec) { - binaryKind = BinaryKind.SHARED_LIBRARY - } else if (bin instanceof StaticLibraryBinarySpec) { - binaryKind = BinaryKind.STATIC_LIBRARY - } else { - throw new RuntimeException("Unknown executable kind ${bin.class.name}") - } + BinaryKind binaryKind + if (bin instanceof NativeExecutableBinarySpec) { + binaryKind = BinaryKind.EXECUTABLE + } else if (bin instanceof SharedLibraryBinarySpec) { + binaryKind = BinaryKind.SHARED_LIBRARY + } else if (bin instanceof StaticLibraryBinarySpec) { + binaryKind = BinaryKind.STATIC_LIBRARY + } else { + 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) { - return rootProject.createMsvcConfig(releaseBuild, binaryKind) - } else if (bin.toolChain instanceof Icc) { - return rootProject.createIccConfig(releaseBuild, binaryKind) - } else { - throw new RuntimeException("Unknown native toolchain: ${bin.toolChain.class.name}") - } + if (bin.toolChain instanceof VisualCpp) { + return rootProject.createMsvcConfig(releaseBuild, binaryKind) + } else if (bin.toolChain instanceof Icc) { + return rootProject.createIccConfig(releaseBuild, binaryKind) + } else if (bin.toolChain instanceof Gcc) { + return rootProject.createGccConfig(releaseBuild, binaryKind) + } else { + throw new RuntimeException("Unknown native toolchain: ${bin.toolChain.class.name}") + } } diff --git a/shared_gcc.gradle b/shared_gcc.gradle new file mode 100644 index 0000000..44d767f --- /dev/null +++ b/shared_gcc.gradle @@ -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 +} diff --git a/shared_icc.gradle b/shared_icc.gradle index d812348..084902b 100644 --- a/shared_icc.gradle +++ b/shared_icc.gradle @@ -3,60 +3,60 @@ import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig import org.doomedsociety.gradlecpp.gcc.OptimizationLevel rootProject.ext.createIccConfig = { boolean release, BinaryKind binKind -> - GccToolchainConfig cfg - if (release) { - cfg = new GccToolchainConfig( - compilerOptions: new GccToolchainConfig.CompilerOptions( - optimizationLevel: OptimizationLevel.LEVEL_3, - stackProtector: false, - interProceduralOptimizations: true, + GccToolchainConfig cfg + if (release) { + cfg = new GccToolchainConfig( + compilerOptions: new GccToolchainConfig.CompilerOptions( + optimizationLevel: OptimizationLevel.LEVEL_3, + stackProtector: false, + interProceduralOptimizations: true, - noBuiltIn: true, + noBuiltIn: true, - intelExtensions: false, - asmBlocks: true, + intelExtensions: false, + asmBlocks: true, - positionIndependentCode: false - ), + positionIndependentCode: false + ), - linkerOptions: new GccToolchainConfig.LinkerOptions( - interProceduralOptimizations: true, - stripSymbolTable: true, - staticLibGcc: true, - staticIntel: true, - staticLibStdCpp: true, - ), + linkerOptions: new GccToolchainConfig.LinkerOptions( + interProceduralOptimizations: true, + stripSymbolTable: true, + staticLibGcc: true, + staticIntel: true, + staticLibStdCpp: true, + ), - librarianOptions: new GccToolchainConfig.LibrarianOptions( + librarianOptions: new GccToolchainConfig.LibrarianOptions( - ) - ) - } else { - //debug - cfg = new GccToolchainConfig( - compilerOptions: new GccToolchainConfig.CompilerOptions( - optimizationLevel: OptimizationLevel.DISABLE, - stackProtector: true, - interProceduralOptimizations: false, + ) + ) + } else { + //debug + cfg = new GccToolchainConfig( + compilerOptions: new GccToolchainConfig.CompilerOptions( + optimizationLevel: OptimizationLevel.DISABLE, + stackProtector: true, + interProceduralOptimizations: false, - noBuiltIn: true, - intelExtensions: false, - asmBlocks: true - ), + noBuiltIn: true, + intelExtensions: false, + asmBlocks: true + ), - linkerOptions: new GccToolchainConfig.LinkerOptions( - interProceduralOptimizations: false, - stripSymbolTable: false, - staticLibGcc: true, - staticIntel: true, - staticLibStdCpp: true, - ), + linkerOptions: new GccToolchainConfig.LinkerOptions( + interProceduralOptimizations: false, + stripSymbolTable: false, + staticLibGcc: true, + staticIntel: true, + staticLibStdCpp: true, + ), - librarianOptions: new GccToolchainConfig.LibrarianOptions( + librarianOptions: new GccToolchainConfig.LibrarianOptions( - ) - ) - } + ) + ) + } - return cfg + return cfg } diff --git a/shared_msvc.gradle b/shared_msvc.gradle index 5b69f4c..04017fb 100644 --- a/shared_msvc.gradle +++ b/shared_msvc.gradle @@ -13,111 +13,111 @@ import org.doomedsociety.gradlecpp.msvc.RuntimeChecks import org.doomedsociety.gradlecpp.msvc.WarningLevel rootProject.ext.createMsvcConfig = { boolean release, BinaryKind binKind -> - MsvcToolchainConfig cfg - if (release) { - cfg = new MsvcToolchainConfig( - compilerOptions: new MsvcToolchainConfig.CompilerOptions( - codeGeneration: CodeGenerationKind.MULTITHREADED, - optimizationLevel: OptimizationLevel.FULL_OPTIMIZATION, - debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, - runtimeChecks: RuntimeChecks.DEFAULT, - cppExceptions: CppExceptions.ENABLED_WITH_SEH, - warningLevel: WarningLevel.LEVEL_3, - callingConvention: CallingConvention.CDECL, - enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, - floatingPointModel: FloatingPointModel.FAST, + MsvcToolchainConfig cfg + if (release) { + cfg = new MsvcToolchainConfig( + compilerOptions: new MsvcToolchainConfig.CompilerOptions( + codeGeneration: CodeGenerationKind.MULTITHREADED, + optimizationLevel: OptimizationLevel.FULL_OPTIMIZATION, + debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, + runtimeChecks: RuntimeChecks.DEFAULT, + cppExceptions: CppExceptions.ENABLED_WITH_SEH, + warningLevel: WarningLevel.LEVEL_3, + callingConvention: CallingConvention.CDECL, + enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, + floatingPointModel: FloatingPointModel.FAST, - enableMinimalRebuild: false, - omitFramePointers: false, - wholeProgramOptimization: true, - enabledFunctionLevelLinking: true, - enableSecurityCheck: true, - analyzeCode: false, - sdlChecks: false, - treatWarningsAsErrors: false, - treatWchartAsBuiltin: true, - forceConformanceInForLoopScope: true, + enableMinimalRebuild: false, + omitFramePointers: false, + wholeProgramOptimization: true, + enabledFunctionLevelLinking: true, + enableSecurityCheck: true, + analyzeCode: false, + sdlChecks: false, + treatWarningsAsErrors: false, + treatWchartAsBuiltin: true, + forceConformanceInForLoopScope: true, - extraDefines: [ - 'WIN32': null, - '_MBCS': null, - 'NDEBUG': null, - ] - ), + extraDefines: [ + 'WIN32': null, + '_MBCS': null, + 'NDEBUG': null, + ] + ), - linkerOptions: new MsvcToolchainConfig.LinkerOptions( - linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG, - errorReportingMode: ErrorReporting.NO_ERROR_REPORT, + linkerOptions: new MsvcToolchainConfig.LinkerOptions( + linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG, + errorReportingMode: ErrorReporting.NO_ERROR_REPORT, - enableIncrementalLinking: false, - eliminateUnusedRefs: true, - enableCOMDATFolding: true, - generateDebugInfo: true, - dataExecutionPrevention: true, - randomizedBaseAddress: true - ), + enableIncrementalLinking: false, + eliminateUnusedRefs: true, + enableCOMDATFolding: true, + generateDebugInfo: true, + dataExecutionPrevention: true, + randomizedBaseAddress: true + ), - librarianOptions: new MsvcToolchainConfig.LibrarianOptions( - linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG - ), + librarianOptions: new MsvcToolchainConfig.LibrarianOptions( + linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG + ), - generatePdb: true - ) - } else { - //debug - cfg = new MsvcToolchainConfig( - compilerOptions: new MsvcToolchainConfig.CompilerOptions( - codeGeneration: CodeGenerationKind.MULTITHREADED_DEBUG, - optimizationLevel: OptimizationLevel.DISABLED, - debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, - runtimeChecks: RuntimeChecks.DEFAULT, - cppExceptions: CppExceptions.ENABLED_WITH_SEH, - warningLevel: WarningLevel.LEVEL_3, - callingConvention: CallingConvention.CDECL, - enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, - floatingPointModel: FloatingPointModel.FAST, + generatePdb: true + ) + } else { + //debug + cfg = new MsvcToolchainConfig( + compilerOptions: new MsvcToolchainConfig.CompilerOptions( + codeGeneration: CodeGenerationKind.MULTITHREADED_DEBUG, + optimizationLevel: OptimizationLevel.DISABLED, + debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, + runtimeChecks: RuntimeChecks.DEFAULT, + cppExceptions: CppExceptions.ENABLED_WITH_SEH, + warningLevel: WarningLevel.LEVEL_3, + callingConvention: CallingConvention.CDECL, + enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, + floatingPointModel: FloatingPointModel.FAST, - enableMinimalRebuild: true, - omitFramePointers: false, - wholeProgramOptimization: false, - enabledFunctionLevelLinking: true, - enableSecurityCheck: true, - analyzeCode: false, - sdlChecks: false, - treatWarningsAsErrors: false, - treatWchartAsBuiltin: true, - forceConformanceInForLoopScope: true, + enableMinimalRebuild: true, + omitFramePointers: false, + wholeProgramOptimization: false, + enabledFunctionLevelLinking: true, + enableSecurityCheck: true, + analyzeCode: false, + sdlChecks: false, + treatWarningsAsErrors: false, + treatWchartAsBuiltin: true, + forceConformanceInForLoopScope: true, - extraDefines: [ - 'WIN32': null, - '_MBCS': null, - '_DEBUG': null, - ] - ), + extraDefines: [ + 'WIN32': null, + '_MBCS': null, + '_DEBUG': null, + ] + ), - linkerOptions: new MsvcToolchainConfig.LinkerOptions( - linkTimeCodeGenKind: LinkTimeCodeGenKind.DEFAULT, - errorReportingMode: ErrorReporting.NO_ERROR_REPORT, + linkerOptions: new MsvcToolchainConfig.LinkerOptions( + linkTimeCodeGenKind: LinkTimeCodeGenKind.DEFAULT, + errorReportingMode: ErrorReporting.NO_ERROR_REPORT, - enableIncrementalLinking: true, - eliminateUnusedRefs: false, - enableCOMDATFolding: false, - generateDebugInfo: true, - dataExecutionPrevention: true, - randomizedBaseAddress: true - ), + enableIncrementalLinking: true, + eliminateUnusedRefs: false, + enableCOMDATFolding: false, + generateDebugInfo: true, + dataExecutionPrevention: true, + randomizedBaseAddress: true + ), - librarianOptions: new MsvcToolchainConfig.LibrarianOptions( - linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG - ), + librarianOptions: new MsvcToolchainConfig.LibrarianOptions( + linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG + ), - generatePdb: true - ) + generatePdb: true + ) - if (binKind == BinaryKind.STATIC_LIBRARY) { - cfg.compilerConfig.extraDefines['_LIB'] = null - } - } + if (binKind == BinaryKind.STATIC_LIBRARY) { + cfg.compilerConfig.extraDefines['_LIB'] = null + } + } - return cfg -} \ No newline at end of file + return cfg +}