| 赞 | 87 |
| VIP | |
| 好人卡 | |
| 积分 | 136 |
| 经验 | |
| 最后登录 | 2021-1-24 |
| 在线时间 | 2753 小时 |
- 梦石
- 0
- 星屑
- 13562
- 在线时间
- 2753 小时
- 注册时间
- 2014-10-4
- 回帖
- 705

|
楼主 |
发表于 2017-12-3 17:56:21
|
显示全部楼层
本帖最后由 SixRC 于 2017-12-3 19:19 编辑
拓展分辨率 这样?
- /* 增加 Graphics.resize_screen(width,height) 方法
- 自动居中放置 支持渐变 不受 640*480 限制 */
- #include <windows.h>
- /* rb_define_module_function、Bitmap_initialize 等地址逆向得到
- RGSSData 是一处 RGSS 存放一些数据的地方
- 其下存有用来渐变的位图、窗口句柄等等数据 */
- static void (*rb_define_module_function)(int,char*,int (*)(),int);
- // 新建 bitmap 去替换原渐变位图
- static int (*Bitmap_initialize)(int,int*,int*);
- // 两个类地址及桌面尺寸
- static int Graphics,Bitmap,desktoprect[4];
- static void** RGSSData;
- static int *FreezeSection,*FreezeSection2;
- // 窗口句柄
- static void* hwnd;
- static RECT* DesktopRect = (RECT*)desktoprect;
- // resize_screen 会传入 类地址 + 其他指定的参数
- static int resize(int graphics,int width,int height){
- // 位图对象的储存方式 [flag 、类地址 、mark 、free 函数 、数据地址] 参考 ruby 源码
- // 数据有三个元素 第三个是位图结构地址
- // 位图结构有 0x58 大 22个元素
- // FreezeSection指向的是位图结构 全复制过去就好 或复制指针 这里复制了所有的元素
- // initialize 方法为可变参数 为 [argc,argv,obj]
- int temp[3],size[]={width,height},new_bitmap[]={0x22,Bitmap,0,0,(int)temp};
- Bitmap_initialize(2,size,new_bitmap);
- // 删除旧位图 位图结构 + 2C 为位图句柄
- DeleteObject((void*)FreezeSection[11]);
- int *newsection = (int*)temp[2];
- for(int i=0;i<22;i++){FreezeSection[i]=newsection[i];}
- // 还需要修改另一块指定的渐变尺寸
- FreezeSection2[4] = width;
- FreezeSection2[5] = height;
- FreezeSection2[50] = width;
- FreezeSection2[51] = height;
- // 渐变处理完毕 然后改窗口尺寸
- // 因为有边框大小 调整一下 并根据桌面大小放置
- // 但边框是定长的还是随不同电脑不同?是否需要获取边框尺寸?这里我懒
- // ruby num 转 int
- width = width >> 1;
- height = height >> 1;
- int x = (DesktopRect->right - width - 6)/2;
- int y = (DesktopRect->bottom - height - 29)/2;
- MoveWindow(hwnd,x,y,width+6,height+29,1);
- // 4 为 nil
- return 4;
- }
- // 初始化 传入dll名 设置变量 增加函数
- void Init_Graphics_Resize(char* dll){
- void *hmodule = GetModuleHandle(dll);
- Graphics = ((int*)(hmodule+0x12DAF4))[0];
- Bitmap = ((int*)(hmodule+0x12DADC))[0];
- rb_define_module_function = hmodule+0x20B80;
- Bitmap_initialize = hmodule+0x50F0;
- RGSSData = ((void***)(hmodule+0x12B6C4))[0];
- hwnd = ((void**)RGSSData)[2];
- FreezeSection = ((int**)(RGSSData+0x144/4))[0];
- FreezeSection2 = ((int**)(RGSSData+0x148/4))[0];
- SystemParametersInfo(48,0,DesktopRect,0);
- // 设置两个参数 但是实际传入的时候多一个 类地址
- rb_define_module_function(Graphics,"resize_screen",resize,2);
- return;
- }
复制代码
调用
- Win32API.new('resize','Init_Graphics_Resize','p','v').call("RGSS103J")
- Graphics.resize_screen(1280,720)
复制代码
Resize.zip
(210.14 KB, 下载次数: 92)
突然想到传入 dll 名没什么意义..因为版本间不通用......
|
评分
-
查看全部评分
|