This repository has been archived by the owner on Nov 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
130 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: maptool | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
paths-ignore: | ||
- '**.md' | ||
- '**.yml' | ||
schedule: | ||
- cron: '30 03 01 */3 *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_linux: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Prepare env | ||
run: | | ||
echo "deb http://dk.archive.ubuntu.com/ubuntu/ xenial main" | sudo tee -a /etc/apt/sources.list | ||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 | ||
sudo dpkg --add-architecture i386 | ||
sudo apt-get update | ||
sudo apt install gcc-5-multilib g++-5-multilib | ||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 100 | ||
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 100 | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: lakwsh/hl2sdk-l4d2 | ||
path: hl2sdk-l4d2 | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: 'true' | ||
path: maptool | ||
- name: Build maptool | ||
working-directory: maptool | ||
run: make all | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: maptool-${{github.run_id}} | ||
path: maptool/Release/maptool.so | ||
compression-level: 9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "sigtool"] | ||
path = sigtool | ||
url = git@github.com:lakwsh/sigtool.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,58 @@ | ||
#include <fstream> | ||
|
||
#include "maptool.h" | ||
#include "matchmaking/l4d2/imatchext_l4d.h" | ||
#include "filesystem.h" | ||
#include <fstream> | ||
#ifdef WIN32 | ||
const char *mat_dll = "matchmaking_ds.dll"; | ||
const char *path = "left4dead2\\addons\\maplist.txt"; | ||
#else | ||
const char *mat_dll = "matchmaking_ds_srv.so"; | ||
const char *path = "left4dead2/addons/maplist.txt"; | ||
#endif | ||
#include "sigtool.h" | ||
|
||
static const char *path = "left4dead2/addons/maplist.txt"; | ||
|
||
maptool g_maptool; | ||
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(maptool, IServerPluginCallbacks, INTERFACEVERSION_ISERVERPLUGINCALLBACKS, g_maptool); | ||
|
||
const char *mlist[] = {"coop", "realism", "versus", "survival", "scavenge"}; | ||
|
||
bool maptool::Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory){ | ||
auto fs = (IFileSystem *)interfaceFactory(FILESYSTEM_INTERFACE_VERSION, NULL); | ||
auto fn = Sys_GetFactory(fs->LoadModule(mat_dll, "GAMEBIN", true)); | ||
if(!fn) return false; | ||
auto match = (IMatchExtL4D *)fn(IMATCHEXT_L4D_INTERFACE, NULL); | ||
if(match){ | ||
KeyValues *mis = match->GetAllMissions(); | ||
if(mis){ | ||
Msg("[maptool] Dumping all missions...\n"); | ||
std::ofstream fs; | ||
fs.open(path, std::ios::out|std::ios::trunc); | ||
KeyValues *map = mis->GetFirstSubKey(); | ||
while(map){ | ||
KeyValues *modes = map->FindKey("modes"); | ||
if(modes && !map->GetInt("BuiltIn")){ | ||
fs<<"<"<<map->GetName()<<"> "<<map->GetString("DisplayTitle")<<std::endl; | ||
uint64 id = map->GetUint64("workshopid"); | ||
if(id) fs<<"url: https://steamcommunity.com/workshop/filedetails/?id="<<id<<std::endl; | ||
else fs<<"url: "<<map->GetString("Website")<<std::endl; | ||
for(unsigned i = 0; i<sizeof(mlist)/sizeof(mlist[0]); i++){ | ||
KeyValues *mode = modes->FindKey(mlist[i]); | ||
if(!mode) continue; | ||
fs<<"["<<mode->GetName()<<"]"<<std::endl; | ||
KeyValues *chap = mode->GetFirstSubKey(); | ||
for(int j = 1; chap && !chap->IsEmpty("Map"); j++){ | ||
fs.width(2); | ||
fs<<j<<": "<<chap->GetString("Map")<<std::endl; | ||
fs<<"name: "<<chap->GetString("DisplayName")<<std::endl; | ||
chap = chap->GetNextKey(); | ||
} | ||
} | ||
fs<<std::endl; | ||
} | ||
map = map->GetNextKey(); | ||
} | ||
fs.close(); | ||
Msg("[maptool] done.\n"); | ||
} | ||
} | ||
return false; | ||
static const char *mlist[] = {"coop", "realism", "versus", "survival", "scavenge"}; | ||
|
||
bool maptool::Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory) { | ||
mem_info info = {"matchmaking_ds_srv.so"}; | ||
if (!find_base(&info)) return false; | ||
auto match = (IMatchExtL4D *)get_sym(base, "_ZL13g_MatchExtL4D"); | ||
if (!match) return false; | ||
|
||
KeyValues *mis = match->GetAllMissions(); | ||
if (!mis) return false; | ||
Msg("[maptool] Dumping all missions...\n"); | ||
|
||
std::ofstream fs; | ||
fs.open(path, std::ios::out | std::ios::trunc); | ||
|
||
KeyValues *map = mis->GetFirstSubKey(); | ||
while (map) { | ||
KeyValues *modes = map->FindKey("modes"); | ||
if (modes && !map->GetInt("BuiltIn")) { | ||
fs << "<" << map->GetName() << "> " << map->GetString("DisplayTitle") << std::endl; | ||
uint64 id = map->GetUint64("workshopid"); | ||
if (id) fs << "url: https://steamcommunity.com/workshop/filedetails/?id=" << id << std::endl; | ||
else fs << "url: " << map->GetString("Website") << std::endl; | ||
|
||
for (unsigned i = 0; i < sizeof(mlist) / sizeof(mlist[0]); i++) { | ||
KeyValues *mode = modes->FindKey(mlist[i]); | ||
if (!mode) continue; | ||
|
||
fs << "[" << mode->GetName() << "]" << std::endl; | ||
KeyValues *chap = mode->GetFirstSubKey(); | ||
for (int j = 1; chap && !chap->IsEmpty("Map"); j++) { | ||
fs.width(2); | ||
fs << j << ": " << chap->GetString("Map") << std::endl; | ||
fs << "name: " << chap->GetString("DisplayName") << std::endl; | ||
chap = chap->GetNextKey(); | ||
} | ||
} | ||
fs << std::endl; | ||
} | ||
map = map->GetNextKey(); | ||
} | ||
|
||
fs.close(); | ||
|
||
Msg("[maptool] done.\n"); | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
#include "eiface.h" | ||
|
||
class maptool:public IServerPluginCallbacks{ | ||
class maptool : public IServerPluginCallbacks { | ||
public: | ||
virtual bool Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory); | ||
virtual void Unload(){ } | ||
virtual void Pause(){ } | ||
virtual void UnPause(){ } | ||
virtual const char *GetPluginDescription(){ return "MapTool v1.0.3, https://github.com/lakwsh/MapTool"; } | ||
virtual void LevelInit(char const *pMapName){ } | ||
virtual void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax){ } | ||
virtual void GameFrame(bool simulating){ } | ||
virtual void LevelShutdown(){ } | ||
virtual void ClientActive(edict_t *pEntity){ } | ||
virtual void ClientDisconnect(edict_t *pEntity){ } | ||
virtual void ClientPutInServer(edict_t *pEntity, char const *playername){ } | ||
virtual void SetCommandClient(int index){ } | ||
virtual void ClientSettingsChanged(edict_t *pEdict){ } | ||
virtual PLUGIN_RESULT ClientConnect(bool *bAllowConnect, edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen){ return PLUGIN_CONTINUE; } | ||
virtual PLUGIN_RESULT ClientCommand(edict_t *pEntity, const CCommand &args){ return PLUGIN_CONTINUE; } | ||
virtual PLUGIN_RESULT NetworkIDValidated(const char *pszUserName, const char *pszNetworkID){ return PLUGIN_CONTINUE; } | ||
virtual void OnQueryCvarValueFinished(QueryCvarCookie_t iCookie, edict_t *pPlayerEntity, EQueryCvarValueStatus eStatus, const char *pCvarName, const char *pCvarValue){ } | ||
virtual bool Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory); | ||
virtual void Unload() { } | ||
virtual void Pause() { } | ||
virtual void UnPause() { } | ||
virtual const char *GetPluginDescription() { return "MapTool v1.1.0, https://github.com/lakwsh/maptool"; } | ||
virtual void LevelInit(char const *pMapName) { } | ||
virtual void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax) { } | ||
virtual void GameFrame(bool simulating) { } | ||
virtual void LevelShutdown() { } | ||
virtual void ClientActive(edict_t *pEntity) { } | ||
virtual void ClientDisconnect(edict_t *pEntity) { } | ||
virtual void ClientPutInServer(edict_t *pEntity, char const *playername) { } | ||
virtual void SetCommandClient(int index) { } | ||
virtual void ClientSettingsChanged(edict_t *pEdict) { } | ||
virtual PLUGIN_RESULT ClientConnect(bool *bAllowConnect, edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen) { return PLUGIN_CONTINUE; } | ||
virtual PLUGIN_RESULT ClientCommand(edict_t *pEntity, const CCommand &args) { return PLUGIN_CONTINUE; } | ||
virtual PLUGIN_RESULT NetworkIDValidated(const char *pszUserName, const char *pszNetworkID) { return PLUGIN_CONTINUE; } | ||
virtual void OnQueryCvarValueFinished(QueryCvarCookie_t iCookie, edict_t *pPlayerEntity, EQueryCvarValueStatus eStatus, const char *pCvarName, const char *pCvarValue) { } | ||
}; | ||
extern maptool g_maptool; |