mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-11-27 07:44:02 +08:00
v8
This commit is contained in:
parent
ea03dc7dd6
commit
1e7d410f9f
@ -24,9 +24,16 @@ namespace
|
|||||||
auto spl = wcschr(text, L'\x03');
|
auto spl = wcschr(text, L'\x03');
|
||||||
strcpy(hp->name, wcasta(std::wstring(text, spl - text)).c_str());
|
strcpy(hp->name, wcasta(std::wstring(text, spl - text)).c_str());
|
||||||
text = spl + 1;
|
text = spl + 1;
|
||||||
spl = wcschr(text, L'\x02');
|
spl = wcschr(text, L'\x04');
|
||||||
*split = std::stoi(std::wstring(text, spl - text));
|
*split = std::stoi(std::wstring(text, spl - text));
|
||||||
text = spl + 1;
|
text = spl + 1;
|
||||||
|
auto embedable = wcschr(text, L'\x02');
|
||||||
|
auto isembedabl = std::stoi(std::wstring(text, embedable - text));
|
||||||
|
if (isembedabl)
|
||||||
|
hp->type |= EMBED_ABLE;
|
||||||
|
else
|
||||||
|
hp->type &= ~EMBED_ABLE;
|
||||||
|
text = embedable + 1;
|
||||||
*data = (uintptr_t)text;
|
*data = (uintptr_t)text;
|
||||||
*len = wcslen(text) * 2;
|
*len = wcslen(text) * 2;
|
||||||
}
|
}
|
||||||
|
@ -21,11 +21,11 @@ function splitfonttext(transwithfont) {
|
|||||||
return transwithfont;
|
return transwithfont;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function cppjsio(name, s_raw, lpsplit) {
|
function cppjsio(name, s_raw, lpsplit, embedable = true) {
|
||||||
if (!s_raw)
|
if (!s_raw)
|
||||||
return s_raw
|
return s_raw
|
||||||
transwithfont = ''
|
transwithfont = ''
|
||||||
s = magicsend + name + '\x03' + lpsplit.toString() + '\x02' + s_raw;
|
s = magicsend + name + '\x03' + lpsplit.toString() + '\x04' + (embedable ? '1' : '0') + '\x02' + s_raw;
|
||||||
if (internal_http_port) {
|
if (internal_http_port) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
var url = 'http://127.0.0.1:' + internal_http_port + '/fuck'
|
var url = 'http://127.0.0.1:' + internal_http_port + '/fuck'
|
||||||
@ -62,6 +62,7 @@ function rpgmakerhook() {
|
|||||||
Window_Base.prototype.drawTextEx_origin = Window_Base.prototype.drawTextEx;
|
Window_Base.prototype.drawTextEx_origin = Window_Base.prototype.drawTextEx;
|
||||||
Window_Base.prototype.drawText_origin = Window_Base.prototype.drawText;
|
Window_Base.prototype.drawText_origin = Window_Base.prototype.drawText;
|
||||||
Window_Message.prototype.originstartMessage = Window_Message.prototype.startMessage;
|
Window_Message.prototype.originstartMessage = Window_Message.prototype.startMessage;
|
||||||
|
Window_Message.prototype.updateMessage_ori = Window_Message.prototype.updateMessage;
|
||||||
|
|
||||||
Bitmap.prototype.drawText_ori = Bitmap.prototype.drawText;
|
Bitmap.prototype.drawText_ori = Bitmap.prototype.drawText;
|
||||||
Bitmap.prototype.last_y = 0;
|
Bitmap.prototype.last_y = 0;
|
||||||
@ -77,7 +78,7 @@ function rpgmakerhook() {
|
|||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
for (lpsplit in Bitmap.prototype.collectstring) {
|
for (lpsplit in Bitmap.prototype.collectstring) {
|
||||||
if (Bitmap.prototype.collectstring[lpsplit].length) {
|
if (Bitmap.prototype.collectstring[lpsplit].length) {
|
||||||
cppjsio('rpgmakermv', Bitmap.prototype.collectstring[lpsplit], lpsplit)
|
cppjsio('rpgmakermv', Bitmap.prototype.collectstring[lpsplit], lpsplit, false)
|
||||||
Bitmap.prototype.collectstring[lpsplit] = ''
|
Bitmap.prototype.collectstring[lpsplit] = ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,6 +104,16 @@ function rpgmakerhook() {
|
|||||||
$gameMessage._texts = [resp]
|
$gameMessage._texts = [resp]
|
||||||
this.originstartMessage();
|
this.originstartMessage();
|
||||||
};
|
};
|
||||||
|
Window_Message.prototype.lastalltext = ''
|
||||||
|
Window_Message.prototype.updateMessage = function () {
|
||||||
|
if (this._textState) {
|
||||||
|
if (Window_Message.prototype.lastalltext != $gameMessage.allText()) {
|
||||||
|
cppjsio('rpgmakermv', $gameMessage.allText(), 18, false);
|
||||||
|
Window_Message.prototype.lastalltext = $gameMessage.allText()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.updateMessage_ori();
|
||||||
|
};
|
||||||
Window_Base.prototype.drawText = function (text, x, y, maxWidth, align) {
|
Window_Base.prototype.drawText = function (text, x, y, maxWidth, align) {
|
||||||
text = cppjsio('rpgmakermv', text, 1)
|
text = cppjsio('rpgmakermv', text, 1)
|
||||||
return this.drawText_origin(text, x, y, maxWidth, align)
|
return this.drawText_origin(text, x, y, maxWidth, align)
|
||||||
|
@ -16,7 +16,8 @@ BOOL APIENTRY DllMain(HMODULE hModule,
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef void (*ProcessEvent)(DWORD);
|
typedef void (*ProcessEvent)(DWORD);
|
||||||
typedef void (*ThreadEvent)(const wchar_t *, const char *, ThreadParam);
|
typedef void (*ThreadEvent)(const wchar_t *, const char *, ThreadParam, bool);
|
||||||
|
typedef void (*ThreadEvent_2)(const wchar_t *, const char *, ThreadParam);
|
||||||
typedef bool (*OutputCallback)(const wchar_t *, const char *, ThreadParam, const wchar_t *);
|
typedef bool (*OutputCallback)(const wchar_t *, const char *, ThreadParam, const wchar_t *);
|
||||||
typedef void (*ConsoleHandler)(const wchar_t *);
|
typedef void (*ConsoleHandler)(const wchar_t *);
|
||||||
typedef void (*HookInsertHandler)(uint64_t, const wchar_t *);
|
typedef void (*HookInsertHandler)(uint64_t, const wchar_t *);
|
||||||
@ -28,13 +29,13 @@ std::optional<T> checkoption(bool check, T &&t)
|
|||||||
return std::move(t);
|
return std::move(t);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
C_LUNA_API void Luna_Start(ProcessEvent Connect, ProcessEvent Disconnect, ThreadEvent Create, ThreadEvent Destroy, OutputCallback Output, ConsoleHandler console, HookInsertHandler hookinsert, EmbedCallback embed, ConsoleHandler Warning)
|
C_LUNA_API void Luna_Start(ProcessEvent Connect, ProcessEvent Disconnect, ThreadEvent Create, ThreadEvent_2 Destroy, OutputCallback Output, ConsoleHandler console, HookInsertHandler hookinsert, EmbedCallback embed, ConsoleHandler Warning)
|
||||||
{
|
{
|
||||||
Host::StartEx(
|
Host::StartEx(
|
||||||
checkoption(Connect, std::function<void(DWORD)>(Connect)),
|
checkoption(Connect, std::function<void(DWORD)>(Connect)),
|
||||||
checkoption(Disconnect, std::function<void(DWORD)>(Disconnect)),
|
checkoption(Disconnect, std::function<void(DWORD)>(Disconnect)),
|
||||||
checkoption(Create, [=](const TextThread &thread)
|
checkoption(Create, [=](const TextThread &thread)
|
||||||
{ Create(thread.hp.hookcode, thread.hp.name, thread.tp); }),
|
{ Create(thread.hp.hookcode, thread.hp.name, thread.tp, thread.hp.type & EMBED_ABLE); }),
|
||||||
checkoption(Destroy, [=](const TextThread &thread)
|
checkoption(Destroy, [=](const TextThread &thread)
|
||||||
{ Destroy(thread.hp.hookcode, thread.hp.name, thread.tp); }),
|
{ Destroy(thread.hp.hookcode, thread.hp.name, thread.tp); }),
|
||||||
checkoption(Output, [=](const TextThread &thread, std::wstring &output)
|
checkoption(Output, [=](const TextThread &thread, std::wstring &output)
|
||||||
|
Loading…
Reference in New Issue
Block a user