CheatMenuSA/src/resourcestore.h

69 lines
1.6 KiB
C
Raw Normal View History

2022-06-29 19:56:53 -04:00
#pragma once
2021-10-25 10:03:27 -04:00
#include <string>
#include <rw/rwcore.h>
2022-06-15 06:45:43 -04:00
#include "datastore.h"
#include "../depend/imgui/imgui.h"
#include "d3d9.h"
struct RwD3D9Raster
{
2022-01-07 03:18:00 -05:00
union
{
IDirect3DTexture9* texture;
IDirect3DSurface9* surface;
};
unsigned char* palette;
unsigned char alpha;
unsigned char cubeTextureFlags; /* 0x01 IS_CUBEMAP_TEX */
unsigned char textureFlags; /* 0x10 IS_COMPRESSED */
unsigned char lockedLevel;
IDirect3DSurface9* lockedSurface;
D3DLOCKED_RECT lockedRect;
D3DFORMAT format;
IDirect3DSwapChain9* swapChain;
HWND* hwnd;
};
struct RwRasterEx : public RwRaster
{
2022-01-07 03:18:00 -05:00
RwD3D9Raster *m_pRenderResource;
};
struct TextureResource
{
2022-01-07 03:18:00 -05:00
std::string m_FileName;
std::string m_CategoryName;
RwTexture *m_pRwTexture = nullptr;
void *m_pTexture = nullptr;
};
enum eResourceType
{
2022-01-07 03:18:00 -05:00
TYPE_IMAGE,
TYPE_TEXT,
2022-06-29 19:56:53 -04:00
TYPE_IMAGE_TEXT, // priotizes images
TYPE_TEXT_IMAGE, // priotizes texts
};
2022-06-12 14:01:43 -04:00
/*
Global Resource Handler Class
Handles loading & unloading both text (json) & image files
*/
class ResourceStore
{
private:
2022-06-12 14:01:43 -04:00
// Loads a image texture from it's path
2021-10-25 10:03:27 -04:00
void LoadTextureResource(std::string&& path);
public:
2022-01-07 03:18:00 -05:00
ImGuiTextFilter m_Filter = "";
std::vector<std::string> m_Categories = {"All"};
std::string m_Selected = "All";
2022-06-15 06:45:43 -04:00
std::unique_ptr<DataStore> m_pData;
2022-06-12 14:01:43 -04:00
std::vector<std::unique_ptr<TextureResource>> m_ImagesList;
2022-01-07 03:18:00 -05:00
ImVec2 m_ImageSize;
2022-06-29 19:56:53 -04:00
eResourceType m_Type;
2022-01-07 03:18:00 -05:00
bool m_bTexturesLoaded = false;
ResourceStore(const char* text, eResourceType type = TYPE_IMAGE, ImVec2 imageSize = ImVec2(64, 64));
};