Skip to content

Commit 56c2cb6

Browse files
committed
Added initial files project
1 parent c59e564 commit 56c2cb6

File tree

451 files changed

+229842
-311
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

451 files changed

+229842
-311
lines changed

.gitignore

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,18 @@
1-
# Compiled Object files
2-
*.slo
3-
*.lo
4-
*.o
5-
*.obj
1+
**/build
2+
**/.gradle
3+
.idea
4+
*.iml
5+
**/msvc/Debug*
6+
**/msvc/Release*
7+
**/msvc/Tests
8+
**/msvc/*.sdf
9+
**/msvc/*.opensdf
10+
**/msvc/*.user
11+
**/msvc/*.suo
12+
**/msvc/ipch
613

7-
# Precompiled Headers
8-
*.gch
9-
*.pch
10-
11-
# Compiled Dynamic libraries
12-
*.so
13-
*.dylib
14-
*.dll
15-
16-
# Fortran module files
17-
*.mod
18-
19-
# Compiled Static libraries
20-
*.lai
21-
*.la
22-
*.a
23-
*.lib
24-
25-
# Executables
26-
*.exe
27-
*.out
28-
*.app
14+
regamedll/version/appversion.h
15+
regamedll/msvc/PublishPath*.txt
16+
regamedll/_regamedllTestImg
17+
regamedll/_dev
18+
publish

LICENSE

Lines changed: 619 additions & 284 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,62 @@
11
# ReGameDLL_CS
22
Reverse-engineered gamedll (mp.dll / Counter-Strike 1.6)
3+
4+
## What is this?
5+
Regamedll_CS is a result of reverse engineering of original library mods HLDS (build 6153beta) using DWARF debug info embedded into linux version of HLDS, cs.so
6+
7+
At the moment, the work of reverse engineering continues
8+
9+
## Goals of the project
10+
<ul>
11+
<li>Provide more stable (than official) version of Half-Life dedicated server with extended API for mods and plugins</li>
12+
</ul>
13+
14+
## How can use it?
15+
At this stage we are working on the reverse engineering cs.so, so temporarily used library with hooks.
16+
<ol>
17+
<li>
18+
You should rename your original a file in the root HLDS filesystem_stdio.dll/so to filesystem_stdio2.dll/so
19+
</li>
20+
<li>
21+
Put a compiled binary a file filesystem_stdio.dll/so in the root HLDS
22+
</li>
23+
</ol>
24+
25+
## Build instructions
26+
There are several software requirements for building rehlds:
27+
<ol>
28+
<li>Java Development Kit (JDK) 7+ (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)</li>
29+
<li>For Windows: Visual Studio 2013 and later</li>
30+
<li>For Linux: Intel C++ Compiler 13 and later</li>
31+
</ol>
32+
33+
### Checking requirements
34+
####JDK version
35+
Windows<pre>&gt; %JAVA_HOME%\bin\javac -version
36+
javac 1.8.0_25
37+
</pre>
38+
39+
Linux
40+
<pre>$ javac -version
41+
javac 1.7.0_65
42+
</pre>
43+
44+
####Visual Studio
45+
Help -> About
46+
47+
####ICC
48+
<pre>$ icc --version
49+
icc (ICC) 15.0.1 20141023
50+
</pre>
51+
52+
### Building
53+
On Windows:
54+
<pre>gradlew --max-workers=1 clean buildRelease</pre>
55+
56+
On Linux:
57+
<pre>./gradlew --max-workers=1 clean buildRelease</pre>
58+
59+
Compiled binaries will be placed in the build/binaries/ directory
60+
61+
### Credits
62+
Thanks to the project [ReHLDS](https://github.com/dreamstalker/rehlds) ( ReGameDLL_CS was created on the basis of ReHLDS )

build.gradle

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import versioning.GitVersioner
2+
import versioning.RegamedllVersionInfo
3+
4+
apply plugin: 'maven-publish'
5+
apply from: 'shared.gradle'
6+
group = 'regamedll'
7+
8+
apply plugin: 'idea'
9+
10+
idea {
11+
project {
12+
languageLevel = 'JDK_1_7'
13+
}
14+
}
15+
16+
def gitInfo = GitVersioner.versionForDir(project.rootDir)
17+
if (!gitInfo) {
18+
throw new RuntimeException('Running outside git repository')
19+
}
20+
21+
22+
23+
RegamedllVersionInfo versionInfo
24+
if (gitInfo.tag && gitInfo.tag[0] == 'v') {
25+
def m = gitInfo.tag =~ /^v(\d+)\.(\d+)(\.(\d+))?$/
26+
if (!m.find()) {
27+
throw new RuntimeException("Invalid git version tag name ${gitInfo.tag}")
28+
}
29+
30+
versionInfo = new RegamedllVersionInfo(
31+
majorVersion: m.group(1) as int,
32+
minorVersion: m.group(2) as int,
33+
maintenanceVersion: m.group(4) ? (m.group(4) as int) : null,
34+
lastCommitDate: gitInfo.lastCommitDate
35+
)
36+
} else {
37+
versionInfo = new RegamedllVersionInfo(
38+
majorVersion: project.majorVersion as int,
39+
minorVersion: project.minorVersion as int,
40+
suffix: 'SNAPSHOT',
41+
lastCommitDate: gitInfo.lastCommitDate
42+
)
43+
}
44+
45+
project.ext.regamedllVersionInfo = versionInfo
46+
project.version = versionInfo.asMavenVersion()
47+
48+
apply from: 'publish.gradle'
49+
50+
task wrapper(type: Wrapper) {
51+
gradleVersion = '2.4'
52+
}

buildSrc/build.gradle

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apply plugin: 'groovy'
2+
3+
repositories {
4+
//mavenLocal()
5+
mavenCentral()
6+
maven {
7+
url 'http://nexus.rehlds.org/nexus/content/repositories/regamedll-releases/'
8+
}
9+
maven {
10+
url 'http://nexus.rehlds.org/nexus/content/repositories/regamedll-snapshots/'
11+
}
12+
13+
}
14+
15+
dependencies {
16+
compile gradleApi()
17+
compile localGroovy()
18+
compile 'commons-io:commons-io:2.4'
19+
compile 'commons-lang:commons-lang:2.6'
20+
compile 'joda-time:joda-time:2.7'
21+
22+
compile 'org.doomedsociety.gradlecpp:gradle-cpp-plugin:1.2'
23+
compile 'org.eclipse.jgit:org.eclipse.jgit:3.7.0.201502260915-r'
24+
25+
//compile 'org.tmatesoft.svnkit:svnkit:1.8.5'
26+
//compile 'org.apache.velocity:velocity-tools:2.0'
27+
28+
compile 'org.apache.velocity:velocity:1.7'
29+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package dirsync.builder
2+
3+
import dirsync.model.tree.DirectoryNode
4+
import dirsync.model.tree.FileNode
5+
import groovy.transform.CompileStatic
6+
7+
class FileSystemTreeBuilder {
8+
9+
@CompileStatic
10+
private static FileNode<File> buildNodeForFile(File file, DirectoryNode<File> parent) {
11+
if (parent.getChildren(file.name)) {
12+
throw new RuntimeException("Parent dir ${parent.name} already contains child node ${file.name}");
13+
}
14+
15+
return new FileNode(
16+
name: file.name,
17+
lastModifiedDate: file.lastModified(),
18+
data: file,
19+
parent: parent,
20+
size: file.size()
21+
);
22+
}
23+
24+
@CompileStatic
25+
private static DirectoryNode<File> buildNodeForDirectoryRecursive(File dir, DirectoryNode<File> parent) {
26+
if (!dir.isDirectory()) {
27+
throw new RuntimeException("File ${dir.absolutePath} is not a directory")
28+
}
29+
30+
if (parent != null && parent.getChildren(dir.name)) {
31+
throw new RuntimeException("Parent dir ${parent.name} already contains child node ${dir.name}");
32+
}
33+
34+
DirectoryNode<File> thisNode = new DirectoryNode(
35+
name: dir.name,
36+
lastModifiedDate: dir.lastModified(),
37+
data: dir,
38+
parent: parent
39+
);
40+
41+
dir.eachFile { File f ->
42+
if (f.isDirectory()) {
43+
thisNode.childNodes[f.name] = buildNodeForDirectoryRecursive(f, thisNode)
44+
} else {
45+
thisNode.childNodes[f.name] = buildNodeForFile(f, thisNode)
46+
}
47+
}
48+
49+
return thisNode;
50+
}
51+
52+
static DirectoryNode<File> buildFileSystemTree(File rootDir) {
53+
def root = buildNodeForDirectoryRecursive(rootDir, null);
54+
PostBuildPass.doPostBuild(root)
55+
56+
return root
57+
}
58+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package dirsync.builder
2+
3+
import dirsync.model.tree.DirectoryNode
4+
import dirsync.model.tree.FileNode
5+
6+
class FileTreeMerger {
7+
8+
private static <T> void mergeContentsRecursive(DirectoryNode<T> newParent, DirectoryNode<T> toMerge) {
9+
toMerge.childNodes.each { cn ->
10+
def node = cn.value
11+
def existingNode = newParent.childNodes[node.name]
12+
if (existingNode) {
13+
if (!(existingNode instanceof DirectoryNode) || !(node instanceof DirectoryNode))
14+
throw new RuntimeException("Failed to merge non-directory nodes ${node.fullPath}")
15+
16+
def existingDirNode = existingNode as DirectoryNode<T>
17+
def dirNode = node as DirectoryNode<T>
18+
19+
existingDirNode.lastModifiedDate = Math.max(existingDirNode.lastModifiedDate, dirNode.lastModifiedDate)
20+
mergeContentsRecursive(existingDirNode, dirNode)
21+
} else {
22+
if (node instanceof DirectoryNode) {
23+
def dirNode = node as DirectoryNode<T>
24+
def newNode = new DirectoryNode<T>(
25+
name: dirNode.name,
26+
data: dirNode.data,
27+
parent: newParent,
28+
lastModifiedDate: dirNode.lastModifiedDate
29+
)
30+
newParent.childNodes[node.name] = newNode
31+
32+
mergeContentsRecursive(newNode, dirNode)
33+
} else {
34+
FileNode<T> fileNode = node as FileNode<T>
35+
FileNode<T> newNode = new FileNode<T>(
36+
name: fileNode.name,
37+
data: fileNode.data,
38+
parent: newParent,
39+
lastModifiedDate: fileNode.lastModifiedDate,
40+
size: fileNode.size
41+
)
42+
43+
newParent.childNodes[node.name] = newNode
44+
}
45+
}
46+
}
47+
}
48+
49+
public static <T> DirectoryNode<T> mergeTrees(DirectoryNode<T> tree1, DirectoryNode<T> tree2) {
50+
DirectoryNode<T> newRoot = new DirectoryNode<T>(
51+
name: tree1.name ?: tree2.name
52+
)
53+
54+
mergeContentsRecursive(newRoot, tree1)
55+
mergeContentsRecursive(newRoot, tree2)
56+
PostBuildPass.doPostBuild(newRoot)
57+
58+
return newRoot
59+
}
60+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package dirsync.builder
2+
3+
import dirsync.model.tree.DirectoryNode
4+
5+
class PostBuildPass {
6+
7+
private static <T> void postProcessRecursive(DirectoryNode<T> dir) {
8+
dir.childNodes.each { cne ->
9+
def childNode = cne.value
10+
childNode.fullPath = dir.fullPath ? dir.fullPath + '/' + childNode.name : childNode.name
11+
if (childNode instanceof DirectoryNode) {
12+
def childDirNode = childNode as DirectoryNode<T>
13+
postProcessRecursive(childDirNode)
14+
}
15+
}
16+
}
17+
18+
static <T> void doPostBuild(DirectoryNode<T> root) {
19+
root.fullPath = ''
20+
postProcessRecursive(root)
21+
}
22+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package dirsync.builder
2+
3+
import dirsync.model.tree.DirectoryNode
4+
import dirsync.model.tree.FileNode
5+
import dirsync.model.tree.ZipData
6+
7+
import java.util.zip.ZipFile
8+
9+
class ZipTreeBuilder {
10+
static DirectoryNode<ZipData> buildForZipArchive(String zipArchive, ZipFile zf) {
11+
DirectoryNode<ZipData> root = new DirectoryNode<>()
12+
13+
zf.entries().each { ze ->
14+
def path = ze.name.replace('\\', '/')
15+
if (path.endsWith('/'))
16+
path = path.substring(0, path.length() - 1)
17+
18+
def parentPath = path.contains('/') ? path.substring(0, path.lastIndexOf('/')) : ''
19+
def childPath = path.contains('/') ? path.substring(path.lastIndexOf('/') + 1) : path
20+
21+
def parentNode = (DirectoryNode<ZipData>) root.getByPath(parentPath)
22+
if (parentNode == null)
23+
throw new RuntimeException("Error reading ${zipArchive}: could not find parent path ${parentPath} for path ${path}")
24+
25+
def childNode = parentNode.getChildren(childPath)
26+
if (childNode)
27+
throw new RuntimeException("Error reading ${zipArchive}: duplicate path ${path}")
28+
29+
if (ze.directory) {
30+
childNode = new DirectoryNode<ZipData>(
31+
name: childPath,
32+
lastModifiedDate: ze.time,
33+
data: new ZipData(zipEntryName: ze.name, zipArchiveName: zipArchive),
34+
parent: parentNode
35+
);
36+
} else {
37+
childNode = new FileNode<ZipData>(
38+
name: childPath,
39+
lastModifiedDate: ze.time,
40+
data: new ZipData(zipEntryName: ze.name, zipArchiveName: zipArchive),
41+
parent: parentNode,
42+
size: ze.size
43+
);
44+
}
45+
parentNode.childNodes[childPath] = childNode
46+
47+
//println '' + ze.directory + ' ' + ze.name + ' ' + parentPath + ' ' + childPath
48+
}
49+
50+
PostBuildPass.doPostBuild(root)
51+
return root
52+
}
53+
}

0 commit comments

Comments
 (0)