Skip to content

Commit

Permalink
3rdparty: add MultiEmulator by 2010kohtep
Browse files Browse the repository at this point in the history
* patched to be portable, turned into a static library
* integrated to the engine
  • Loading branch information
a1batross committed Oct 15, 2024
1 parent a32c702 commit 21f4d14
Show file tree
Hide file tree
Showing 26 changed files with 3,397 additions and 6 deletions.
21 changes: 21 additions & 0 deletions 3rdparty/MultiEmulator/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2017-2018 Alexander Belkin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
25 changes: 25 additions & 0 deletions 3rdparty/MultiEmulator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# MultiEmulator

**MultiEmulator** - project for GoldSource Engine, which provides ability to generate tickets with a specific SteamID key, using all available emulators for this engine.

Ticket is processed by the game server of Half-Life 1 and modifications using **DProto** or **ReUnion** modules. If the server does not have these modules, then MultiEmulator won't work.

# Ticket generators

Currently available ticket generators:
* OldRevEmu
* AVSMP
* Setti
* SteamEmu
* RevEmu
* SC2009
* RevEmu2013

Currently under development generators:
* SmartSteamEmu (SSE3)

# How to use?
Each file in the **MultiEmulator\Source\Emulators** folder contains a **Generate** function that writes a ticket to the **pDest** argument for the emulator of the same name as a header file. As a result of the function, the size of the written ticket is returned. If the generator can set an arbitrary SteamID, the function will have the **nSteamID** argument, in which the required SteamID is specified.

# Examples
As an example, the DLL was developed that searches InitiateGameConnection method in ISteamUser interface, which generates Steam ticket, and inserts in its place own generator, which creates RevEmu2013 ticket with SteamID equal to 3333333. You can find this project in **Example** folder, you just need to compile it and perform DLL injection in hl.exe process with any known injection method.
37 changes: 37 additions & 0 deletions 3rdparty/MultiEmulator/include/multi_emulator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#ifndef MULTI_EMULATOR_H
#define MULTI_EMULATOR_H

#if defined( __GNUC__ )
#if defined( __i386__ )
#define ME_EXPORT __attribute__(( visibility( "default" ), force_align_arg_pointer ))
#else
#define ME_EXPORT __attribute__(( visibility ( "default" )))
#endif
#else
#if defined( _MSC_VER )
#define ME_EXPORT __declspec( dllexport )
#else
#define ME_EXPORT
#endif
#endif

#include <string.h>

#if __cplusplus
extern "C"
{
#endif

int ME_EXPORT GenerateRevEmu2013( void *pDest, int nSteamID );
int ME_EXPORT GenerateSC2009( void *pDest, int nSteamID );
int ME_EXPORT GenerateOldRevEmu( void *pDest, int nSteamID );
int ME_EXPORT GenerateSteamEmu( void *pDest, int nSteamID );
int ME_EXPORT GenerateRevEmu( void *pDest, int nSteamID );
int ME_EXPORT GenerateSetti( void *pDest );
int ME_EXPORT GenerateAVSMP( void *pDest, int nSteamID, int bUniverse );

#if __cplusplus
}
#endif

#endif // MULTI_EMULATOR_H
13 changes: 13 additions & 0 deletions 3rdparty/MultiEmulator/src/AVSMP.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "multi_emulator.h"

/* bUniverse param is "y" value in "STEAM_x:y:z" */
int GenerateAVSMP(void *pDest, int nSteamID, int bUniverse)
{
auto pTicket = (int *)pDest;

pTicket[0] = 0x14; // +0, header
pTicket[3] = (nSteamID << 1) | (bUniverse ? 1 : 0); // +12, SteamId, Low part
pTicket[4] = 0x01100001; // +16, SteamId, High part

return 28;
}
Loading

0 comments on commit 21f4d14

Please sign in to comment.