Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lakwsh committed Oct 22, 2022
1 parent a9fd440 commit e146cd4
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 124 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#####################################

PROJECT = maptool
OBJECTS = maptool.cpp signature.cpp
OBJECTS = maptool.cpp

##############################################
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
Expand Down
59 changes: 28 additions & 31 deletions maptool.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "maptool.h"
#ifdef WIN32
const char *mat_dll[] = {"matchmaking_ds.dll", "matchmaking.dll", 0};
const char *mat_dll = "left4dead2\\bin\\matchmaking_ds.dll";
#else
const char *mat_dll[] = {"matchmaking_ds_srv.so", 0};
const char *mat_dll = "left4dead2/bin/matchmaking_ds_srv.so";
#endif

maptool g_maptool;
Expand All @@ -11,40 +11,37 @@ EXPOSE_SINGLE_INTERFACE_GLOBALVAR(maptool, IServerPluginCallbacks, INTERFACEVERS
const char *mlist[] = {"coop", "realism", "versus", "survival", "scavenge"};

bool maptool::Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory){
mem_info base = {NULL, 0};
find_base_from_list(mat_dll, &base);
auto inf = (void *(*)(const char *, int *))get_func(base.addr, "CreateInterface");
if(inf){
uint **match = (uint **)inf("IMATCHEXT_L4D_INTERFACE_001", NULL);
if(match){
KeyValues *mis = ((KeyValues *(*)(void *))match[0][0])(match);
if(mis){
Msg("[maptool] Dumping all missions...");
KeyValues *map = mis->GetFirstSubKey();
while(map){
KeyValues *modes = map->FindKey("modes");
if(modes){
Msg("[%s] %s\n", map->GetName(), map->GetString("DisplayTitle"));
uint64 id = map->GetUint64("workshopid");
if(id) Msg("url: http://steamcommunity.com/workshop/filedetails/?id=%llu\n", id);
else Msg("url: %s\n", map->GetString("Website"));
for(unsigned i = 0; i<sizeof(mlist)/sizeof(mlist[0]); i++){
KeyValues *mode = modes->FindKey(mlist[i]);
if(!mode) continue;
Msg("mode: %s\n", mode->GetName());
KeyValues *chap = mode->GetFirstSubKey();
while(chap && !chap->IsEmpty("Map")){
Msg("code: %s\n", chap->GetString("Map"));
Msg("name: %s\n", chap->GetString("DisplayName"));
chap = chap->GetNextKey();
}
auto fn = Sys_GetFactory(mat_dll);
if(!fn) return false;
uint **match = (uint **)fn("IMATCHEXT_L4D_INTERFACE_001", NULL);
if(match){
KeyValues *mis = ((KeyValues *(*)(void *))match[0][0])(match);
if(mis){
Msg("[maptool] Dumping all missions...\n");
KeyValues *map = mis->GetFirstSubKey();
while(map){
KeyValues *modes = map->FindKey("modes");
if(modes && !map->GetInt("BuiltIn")){
Msg("<%s> %s\n", map->GetName(), map->GetString("DisplayTitle"));
uint64 id = map->GetUint64("workshopid");
if(id) Msg("url: https://steamcommunity.com/workshop/filedetails/?id=%llu\n", id);
else Msg("url: %s\n", map->GetString("Website"));
for(unsigned i = 0; i<sizeof(mlist)/sizeof(mlist[0]); i++){
KeyValues *mode = modes->FindKey(mlist[i]);
if(!mode) continue;
Msg("[%s]\n", mode->GetName());
KeyValues *chap = mode->GetFirstSubKey();
for(int j = 1; chap && !chap->IsEmpty("Map"); j++){
Msg("%2d: %s\n", j, chap->GetString("Map"));
Msg("name: %s\n", chap->GetString("DisplayName"));
chap = chap->GetNextKey();
}
}
map = map->GetNextKey();
Msg("\n");
}
Msg("[maptool] done.");
map = map->GetNextKey();
}
Msg("[maptool] done.\n");
}
}
return false;
Expand Down
4 changes: 1 addition & 3 deletions maptool.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#include "eiface.h"

#include "signature.h"

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.0, https://github.com/lakwsh/maptool"; }
virtual const char *GetPluginDescription(){ return "maptool v1.0.1, 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){ }
Expand Down
74 changes: 0 additions & 74 deletions signature.cpp

This file was deleted.

15 changes: 0 additions & 15 deletions signature.h

This file was deleted.

0 comments on commit e146cd4

Please sign in to comment.