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. 关于手机微网站ICP备案

    今天终于拨通了陕西省通信管理局的电话,并告诉对方我们做的是一个化妆品的微网站,会涉及到使用使用支付宝支付. 询问"xxx微网站"网站经营类型,对方告知虽然使用支付宝,但是是微网站, ...

  2. 【CSharp】C#开发ActiveX插件

    这几天Web项目中需要用到ActiveX插件(PS:听说这个是好久好久的东西了...),由于项目中需要调用本地资源所以只能研究研究这位老兄了. 先说说自己学习他的经历,开始的时候是用百度引擎检索自己所 ...

  3. 如何在Java Filter 中注入 Service

    在项目中遇到一个问题,在 Filter中注入 Serivce失败,注入的service始终为null.如下所示: public class WeiXinFilter implements Filter ...

  4. ehcache入门

    一.简介 ehcache是一个开源的,纯java进程内的缓存框架.它具有快速,简单,具有多种缓存策略等特点. Hibernate中默认就是用了ehcache.在我们的应用中使用ehcache可以快速地 ...

  5. PL/SQL之--流程控制语句

    一.简介 像编程语言一样,oracle PL/SQL也有自己的流程控制语句.通过流程控制语句,我们可以在PL/SQL中实现一下比较复杂的业务逻辑操作.而无需到程序中去控制,在一定程度上提高了效率,这也 ...

  6. 一个关于group by和having子句的小例子

    表结构: 要求: 查询有多个员工的工资不低于2000的部门编号(就是说如果一个部门的员工大于2000的人数有两个或两个以上就查询出来) sql语句: select [DEPARTMENT_ID],co ...

  7. jenkins 更换主数据目录

    工作中,由于Jenkins默认的主目录空间太小,导致需要将Jenkins默认的主目录修改到其它目录.本文针对更改Jenkins的主目录详细介绍. 注意:在Jenkins运行时是不能更改的. 请先将Je ...

  8. WCF 删除队列

    Configuration config = ConfigurationManager.OpenExeConfiguration (ConfigurationUserLevel.None); Serv ...

  9. Hive history date mapping

    Hive history table mapping create table fdl_family as select * from (select 'acc1' as account,'famil ...

  10. 基于元数据的ETL系统

     从努力到选择  从实现到设计 从部分到整体 以下是我对DW design的一些想法 下次使用C#来实现一下   ETL中Source 的信息       数据提供形式:DB(ORACLE SQLSE ...