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的更多相关文章

  1. [MetaHook] Load TGA texture to OpenGL

    This function load a *.tga texture file and convert to OpenGL pixel format, uncompress only. #pragma ...

  2. [MetaHook] Load DTX texture to OpenGL

    This function load a LithTech *.dtx texture file and convert to OpenGL pixel format, compressed supp ...

  3. Projective Texture的原理与实现

    http://blog.csdn.net/xukunn1226/article/details/775644 Projective Texture是比较常见的一种技术,实现起来代码也就区区的不过百行, ...

  4. Introducing DataFrames in Apache Spark for Large Scale Data Science(中英双语)

    文章标题 Introducing DataFrames in Apache Spark for Large Scale Data Science 一个用于大规模数据科学的API——DataFrame ...

  5. Projective Texture的原理与实现 【转】

              Projective Texture是比较常见的一种技术,实现起来代码也就区区的不过百行,了解其原理及技术细节是我们的重点,知其然,知其所以然.        粗略的说就是想象场景 ...

  6. "NHibernate.Exceptions.GenericADOException: could not load an entity" 解决方案

     今天,测试一个项目的时候,抛出了这个莫名其妙的异常,然后就开始了一天的调试之旅... 花了很长时间,没有从代码找出任何问题... 那么到底哪里出问题呢? 根据下面那段长长的错误日志: -- ::, ...

  7. ExtJS笔记 Ext.data.Model

    A Model represents some object that your application manages. For example, one might define a Model ...

  8. UnityException: Texture is not readable

    原地址:http://blog.csdn.net/emoonight/article/details/18002913 fore you can save or load a Texture, you ...

  9. yii2 model源码解读

    模型yii\base\Model 模型主要实现了验证规则和验证器确保输入的数据是安全和正确的. 模型的流程: 1.从请求中读取数据.使用load或者loadMultiple或者手动赋值.load会根据 ...

随机推荐

  1. VMware虚拟机网络环境类型

    0x01. VMware Ubuntu虚拟机网络环境 ① Bridge桥接模式:虚拟机与物理机的IP同在一个网段:虚拟机独立且地位与物理机相同:虚拟机可直接访问物理机以及物理机相连的外部网络的主机或网 ...

  2. MS SqlServer学习笔记(索引)

    1.索引分类 MS SqlServer提供了两种索引:聚集索引和非聚集索引: 聚集索引是将数据按照索引的顺序存放 非聚集索引是将索引和数据分离存放,通过指针将二者联系到一起. 因为两种索引对比: 使用 ...

  3. mybatis java.lang.UnsupportedOperationException

    mybatis抛出下面的异常: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exc ...

  4. PHP递归创建多级目录(一道面试题的解题过程)

    今天看到一道面试题,要写出一个可以创建多级目录的函数: 我的第一个感觉就是用递归创建,具体思路如下: function Directory($dir){ if(is_dir($dir) || @mkd ...

  5. windows 下my.ini的配置优化

    线上有若干WIN环境下的MySQL,需要进行优化配置,列出以下参数方便查阅 # For advice on how to change settings please see # http://dev ...

  6. zookeeper 集群搭建

    windows 环境下单机搭建伪集群 zookeeper 版本3.4.8 1.创建各个目录server1.server2.server3 2.复制解压后的zookeeper3.4.8 到server1 ...

  7. PHP验证码

    设计一个验证码类,在需要的时候可以随时调用 验证码类,保存为ValidateCode.class.php <?php //验证码类 session_start(); class Validate ...

  8. 04_最长上升子序列问题(LIS)

    来源:刘汝佳<算法竞赛入门经典--训练指南> P60 问题6: 问题描述:给定n个整数a1,a2,...,an,按从左到右的顺序选出尽量多的整数,组成一个上升子序列(子序列可以理解为:删除 ...

  9. scau 8633 回文划分

    8633 回文划分 时间限制:1000MS  内存限制:1000K 题型: 编程题   语言: 无限制 Description 我们说一个字符串是回文串,那么意味着这个串从两边读起来的字母都是一样的. ...

  10. JVM的内存区域划分

            JVM的内存区域划分 学过C语言的朋友都知道C编译器在划分内存区域的时候经常将管理的区域划分为数据段和代码段,数据段包括堆.栈以及静态数据区.那么在Java语言当中,内存又是如何划分的 ...