Files
gMod/header/uMod_TextureServer.h
T
DubbleClick a7e36fc965 rename to gmod, drop gui (#1)
* remove GUI parts as those will not be updated

* move to header/source

* add cmakelist to create solution

* Change Readme

* Implement modlist.txt loading

* Setup versioning and CD pipeline

* Setup DirectX in pipeline

* Make uMod load from uMod.dll directory

* Fix file loading

* Remove break

* Fix CD pipeline (#1)

* Test cd pipeline

* See what's in Lib directory

* See inside lib/x86

* Manually adjust the build environment

* Disable CD pipeline in PRs
Create CI pipeline

* Fix slashes in path

* Fix build call

* Attempt to fix paths

* Copy dx headers inside the /header folder

* Use ps

* Change cache location

* Path changes

* Improve CMake to look for lib and header files

* Fix missing Lib folder

* Move changes to CD pipeline

* Disable CI on merge and fix CD (#2)

* Fix CD tag (#4)

* Hijack existing DirectX calls (#5)

* Create a dll without listener (#6)

* Fix asset creation in CD pipeline (#7)

* Setup file loading

* create necessary files

* merge latest changes, set output dir

* Change main to master in pipelines
Add fallback for DX libs in CMakeLists

* Setup new generator

* formatting

* remove listener

* Change CD to pick the dll from bin
Change release name to gMod

* more formatting

* add editorconfig

* Setup versioning

* Remove CODEOWNERS

---------

Co-authored-by: Alex Macocian <amacocian@yahoo.com>
2023-11-10 17:40:30 +01:00

87 lines
3.0 KiB
C++

#pragma once
#include "uMod_GlobalDefines.h"
#include "uMod_ArrayHandler.h"
/*
* An object of this class is created only once.
* The Mainloop functions is executed by a server thread,
* which listen on a pipe.
*
* Functions called by the Client are called from the a thread instance of the game itself.
* Nearly all other functions are called from the server thread instance.
*/
class uMod_TextureClient;
class uMod_TextureServer {
public:
uMod_TextureServer(char* name, char* uModName);
~uMod_TextureServer();
int AddClient(uMod_TextureClient* client, TextureFileStruct** update, int* number); // called from a Client
int RemoveClient(uMod_TextureClient* client); // called from a Client
int MainLoop(); // is executed in a server thread
// following functions are only public for testing purpose !!
// they should be private and only be called from the Mainloop
int AddFile(char* buffer, unsigned int size, MyTypeHash hash, bool force); // called from Mainloop(), if the content of the texture is sent
int AddFile(wchar_t* file_name, MyTypeHash hash, bool force); // called from Mainloop(), if the name and the path to the file is sent
int RemoveFile(MyTypeHash hash); // called from Mainloop()
int SaveAllTextures(bool val); // called from Mainloop()
int SaveSingleTexture(bool val); // called from Mainloop()
int SetSaveDirectory(wchar_t* dir); // called from Mainloop()
int SetKeyBack(int key); // called from Mainloop()
int SetKeySave(int key); // called from Mainloop()
int SetKeyNext(int key); // called from Mainloop()
int SetFontColour(DWORD colour); // called from Mainloop()
int SetTextureColour(DWORD colour); // called from Mainloop()
private:
bool BoolSaveAllTextures;
bool BoolSaveSingleTexture;
wchar_t SavePath[MAX_PATH];
wchar_t GameName[MAX_PATH];
char UModName[MAX_PATH];
void LoadModsFromFile(char* source);
int PropagateUpdate(uMod_TextureClient* client = nullptr); // called from Mainloop() if texture are loaded or removed
int PrepareUpdate(TextureFileStruct** update, int* number); // called from PropagateUpdate() and AddClient()
// generate a copy of the current texture to be modded
// the file content of the textures are not copied, the clients get the pointer to the file content
// but the arrays allocate by this function, must be deleted by the client
int LockMutex();
int UnlockMutex();
HANDLE Mutex;
int KeyBack;
int KeySave;
int KeyNext;
DWORD FontColour;
DWORD TextureColour;
PipeStruct Pipe;
uMod_TextureClient** Clients;
int NumberOfClients;
int LenghtOfClients;
uMod_FileHandler CurrentMod; // hold the file content of texture
uMod_FileHandler OldMod; // hold the file content of texture which were added previously but are not needed any more
// this is needed, because a texture clients might not have merged the last update and thus hold pointers to the file content of old textures
};