-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsrc.cpp
More file actions
74 lines (61 loc) · 2.14 KB
/
src.cpp
File metadata and controls
74 lines (61 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include <windows.h>
#include <filter.h>
FILTER_DLL filter = {
FILTER_FLAG_ALWAYS_ACTIVE | FILTER_FLAG_NO_CONFIG,
NULL,NULL,
const_cast<char*>("レイヤーホイール"),
NULL,NULL,NULL,
NULL,NULL,
NULL,NULL,NULL,
NULL,
func_init,
};
EXTERN_C FILTER_DLL __declspec(dllexport)* __stdcall GetFilterTable(void) {
return &filter;
}
static int exedit_base;
static HWND exedit_hwnd;
FILTER* get_exeditfp(FILTER* fp) {
SYS_INFO si;
fp->exfunc->get_sys_info(NULL, &si);
for (int i = 0; i < si.filter_n; i++) {
FILTER* tfp = (FILTER*)fp->exfunc->get_filterp(i);
if (tfp->information != NULL) {
if (!strcmp(tfp->information, "拡張編集(exedit) version 0.92 by KENくん")) return tfp;
}
}
return NULL;
}
BOOL exedit_ReplaceCall(DWORD exedit_address, void* new_address) {
DWORD oldProtect;
DWORD* address = (DWORD*)(exedit_address + exedit_base);
if (!VirtualProtect(address, 4, PAGE_EXECUTE_READWRITE, &oldProtect)) {
return FALSE;
}
*address = (DWORD)new_address - (DWORD)address - 4;
return VirtualProtect(address, 4, oldProtect, &oldProtect);
}
void __cdecl scroll_horizontal_wrap(int x_ofs) {
POINT point;
GetCursorPos(&point);
ScreenToClient(exedit_hwnd, &point);
if (point.x < 64) { // vertical
int timeline_frame_pos = *(int*)(exedit_base + 0x1a52f0);
int timeline_layer_pos = *(int*)(exedit_base + 0x1a5308);
int wheel = (timeline_frame_pos < x_ofs) * 2 + -1;
reinterpret_cast<void(__cdecl*)(int, BOOL)>(exedit_base + 0x38b70)(timeline_layer_pos + wheel, TRUE);
} else { // horizontal
reinterpret_cast<void(__cdecl*)(int)>(exedit_base + 0x38c70)(x_ofs);
}
}
BOOL func_init(FILTER* fp) {
FILTER* exeditfp = get_exeditfp(fp);
if (exeditfp == NULL) {
MessageBoxA(fp->hwnd, "拡張編集0.92が見つかりませんでした", fp->name, MB_OK);
return TRUE;
}
exedit_base = (int)exeditfp->dll_hinst;
exedit_hwnd = exeditfp->hwnd;
exedit_ReplaceCall(0x3df3a, &scroll_horizontal_wrap);
return TRUE;
}