danielkrupinski / Osiris

Cross-platform game hack for Counter-Strike 2 with Panorama-based GUI.
MIT License
3.35k stars 961 forks source link

[NOT AN ISSUE] - Need help on displaying image from memory in GUI.CPP #1840

Closed free0ne87 closed 4 years ago

free0ne87 commented 4 years ago

Hi guys, sorry for the bad place, but I really can't find any valid documentation that I could understand. Maybe because I'm still a noob with D3DX. So basically I'm searching for ready pasta to render image from memory with D3DXCreateTextureFromFileInMemory maybe. Just want to make Osiris menu awesome!

I will be very grateful for any help.

Jimmy-Baby commented 4 years ago

It would be much easier to just use ImGui for this, rather than DXD9.

This has been spoken about in a few issues before.

free0ne87 commented 4 years ago

It is indeed easier to use ImGui, the problem is that I couldn't find any example with image loading from memory. Saw some issues with image loading from file, which is not what I want if I can't get dynamic dll path.

Jimmy-Baby commented 4 years ago

It is indeed easier to use ImGui, the problem is that I couldn't find any example with image loading from memory. Saw some issues with image loading from file, which is not what I want if I can't get dynamic dll path.

I use this method in my own cheat, WR417H, read below.

It's possible to store images into True Font File's to replace the use of characters.

You can convert .TTF files into binary which can easily be stored in any unsigned character array (unsigned char, uint8_t, etc). Note that with uint*_t types you will be limited to how large the array can be without receiving buffer errors or similar, so it's probably best to just define your own type: typedef unsigned char memoryFont;

Later you can define your font: memoryFont* menuIcons = io.fonts->LoadTTFFromMemory(...);

And then use ImGui::PushFont(); and ImGui::PopFont(); And, From there, you can just use ImGui::Text() to draw images at your own will.

free0ne87 commented 4 years ago

I'm already using icon fonts, but for example if I want to display weapon skin or any other kind of colored image, I can't use it with fonts, because it will become like a monocolor icon.

Thanks for suggestion, anyway.

Jimmy-Baby commented 4 years ago

I'm already using icon fonts, but for example if I want to display weapon skin or any other kind of colored image, I can't use it with fonts, because it will become like a monocolor icon.

Thanks for suggestion, anyway.

Ahhhh, I see. Right right. Well, what types of things are you looking to render? If you don't want grayscale images.

free0ne87 commented 4 years ago

weapon_glock_aa_fade_light_large 61edcc69ff252d537a4dd14b016cbe826c26ae5b

Let's say I want to render this image in skinchanger. I don't want to store images in csgo folder, also if all those images may overload memory I preffer storing them on a dynamic path alongside osiris.dll. Is there any way?

Cyk-Fad commented 4 years ago

It is indeed easier to use ImGui, the problem is that I couldn't find any example with image loading from memory. Saw some issues with image loading from file, which is not what I want if I can't get dynamic dll path.

I use this method in my own cheat, WR417H, read below.

It's possible to store images into True Font File's to replace the use of characters.

You can convert .TTF files into binary which can easily be stored in any unsigned character array (unsigned char, uint8_t, etc). Note that with uint*_t types you will be limited to how large the array can be without receiving buffer errors or similar, so it's probably best to just define your own type: typedef unsigned char memoryFont;

Later you can define your font: memoryFont* menuIcons = io.fonts->LoadTTFFromMemory(...);

And then use ImGui::PushFont(); and ImGui::PopFont(); And, From there, you can just use ImGui::Text() to draw images at your own will.

How to convert .TTF files into binary? I don't know hot to do this

free0ne87 commented 4 years ago

Check here! https://github.com/ocornut/imgui/blob/master/misc/fonts/binary_to_compressed_c.cpp