[MetaHook] Load large texture from model
We need hook "GL_LoadTexture" engine function.
GL_LOADTEXTURE_SIG from hw.dll(3266) engine, can not use for other engine version.
#include <metahook.h>
#include "qgl.h"
#include "surface.h" extern DWORD g_dwEngineBase, g_dwEngineSize; #define GL_LOADTEXTURE_SIG "\xA1\xC8\x20\xEC\x01\x8B\x4C\x24\x20\x8B\x54\x24\x1C\x50\x8B\x44" int (*g_pfnGL_LoadTexture)(char *identifier, int textureType, int width, int height, BYTE *data, int mipmap, int iType, BYTE *pPal) = ; int GL_LoadTexture(char *identifier, int textureType, int width, int height, BYTE *data, int mipmap, int iType, BYTE *pPal)
{
if (width > || height > )
{
static BYTE buffer[ * * ]; for (DWORD i = ; i < width * height; ++i)
{
buffer[(i * ) + ] = pPal[(data[i] * ) + ];
buffer[(i * ) + ] = pPal[(data[i] * ) + ];
buffer[(i * ) + ] = pPal[(data[i] * ) + ];
} int id = g_pSurface->CreateNewTextureID(); qglBindTexture(GL_TEXTURE_2D, id);
qglTexImage2D(GL_TEXTURE_2D, , GL_RGB, width, height, , GL_RGB, GL_UNSIGNED_BYTE, buffer);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); return id;
} return g_pfnGL_LoadTexture(identifier, textureType, width, height, data, mipmap, iType, pPal);
} void Hook_InstallHook(void)
{
g_pfnGL_LoadTexture = (int (*)(char *, int, int, int, BYTE *, int, int, BYTE *))g_pMetaHookAPI->SearchPattern((void *)g_dwEngineBase, g_dwEngineSize, GL_LOADTEXTURE_SIG, sizeof(GL_LOADTEXTURE_SIG) - ); if (g_pfnGL_LoadTexture)
{
g_pMetaHookAPI->InlineHook(g_pfnGL_LoadTexture, GL_LoadTexture, (void *&)g_pfnGL_LoadTexture);
}
}
[MetaHook] Load large texture from model的更多相关文章
- [MetaHook] Load TGA texture to OpenGL
This function load a *.tga texture file and convert to OpenGL pixel format, uncompress only. #pragma ...
- [MetaHook] Load DTX texture to OpenGL
This function load a LithTech *.dtx texture file and convert to OpenGL pixel format, compressed supp ...
- Projective Texture的原理与实现
http://blog.csdn.net/xukunn1226/article/details/775644 Projective Texture是比较常见的一种技术,实现起来代码也就区区的不过百行, ...
- Introducing DataFrames in Apache Spark for Large Scale Data Science(中英双语)
文章标题 Introducing DataFrames in Apache Spark for Large Scale Data Science 一个用于大规模数据科学的API——DataFrame ...
- Projective Texture的原理与实现 【转】
Projective Texture是比较常见的一种技术,实现起来代码也就区区的不过百行,了解其原理及技术细节是我们的重点,知其然,知其所以然. 粗略的说就是想象场景 ...
- "NHibernate.Exceptions.GenericADOException: could not load an entity" 解决方案
今天,测试一个项目的时候,抛出了这个莫名其妙的异常,然后就开始了一天的调试之旅... 花了很长时间,没有从代码找出任何问题... 那么到底哪里出问题呢? 根据下面那段长长的错误日志: -- ::, ...
- ExtJS笔记 Ext.data.Model
A Model represents some object that your application manages. For example, one might define a Model ...
- UnityException: Texture is not readable
原地址:http://blog.csdn.net/emoonight/article/details/18002913 fore you can save or load a Texture, you ...
- yii2 model源码解读
模型yii\base\Model 模型主要实现了验证规则和验证器确保输入的数据是安全和正确的. 模型的流程: 1.从请求中读取数据.使用load或者loadMultiple或者手动赋值.load会根据 ...
随机推荐
- 输入三个整数,xyz,最终以从小到大的方式输出。利用中间变量
<script>function bijiao(){ var x= parseFloat(document.getElementById("X").value); va ...
- 人生导师——如何学习C++的Windows方向
原来发在百度上,今天被人挖坟挖出来了,我就再贴出来吧. -----------------------有什么说的不对的地方---------------------- 本文原创,转载请注明出处并保持文 ...
- redis动态修改参数配置
./redis-cli -h 10.10.10.11 -p 6401 save # 保存当前快照 # 列出所有当前配置 config get * # 查看指定配置 config get ...
- oracle11G在linux环境下的卸载操作
1.使用SQL*PLUS停止数据库[oracle@OracleTest oracle]$ sqlplus logSQL> connect / as sysdbaSQL> shutdown ...
- [分享]4412开发板Android教程——Android开发环境搭建
分享视频链接:http://pan.baidu.com/s/1o6tgEeQ 本文转载:www.topeetboard.com 下载和安装Android应用的开发环境 新建Android虚拟环境 An ...
- web工程 所需是jar包总结
commons-beanutils-1.8.3.jar : BeanUtils主要提供了对于JavaBean进行各种操作,需要Commons -Collections包和Commons -loggin ...
- 探索 OpenStack 之(15):oslo.messaging 和 Cinder 中 MessageQueue 消息的发送和接收
前言:上一篇文章 只是 RabbitMQ 的科普,本文将仔细分析 Cinder 中 RabbitMQ 的各组件的使用.消息的发送和接收等.由于各流程步骤很多,本文只会使用若干流程图来加以阐述,尽量做到 ...
- [转]Ionic Datepicker
本文转自:https://market.ionic.io/plugins/ionicdatepicker ##Introduction: This is an ionic-datepicker bow ...
- [转]NPOI TestFunctionRegistry.cs
本文转自:https://github.com/tonyqus/npoi/blob/master/testcases/main/SS/Formula/TestFunctionRegistry.cs ...
- SpringBoot 快速入门
本篇文章翻译来源为:http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/ 首先springboot ...