mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-23 00:40:51 +01:00
fix module and returnbyte
This commit is contained in:
parent
823f3a7e67
commit
ad46a76bbf
@ -125,7 +125,7 @@ public class UnityWebModifyer {
|
|||||||
contents = contents
|
contents = contents
|
||||||
.replace("var _free", "_free")
|
.replace("var _free", "_free")
|
||||||
.replace("var _malloc", "_malloc")
|
.replace("var _malloc", "_malloc")
|
||||||
.replace("var Module", "Module")
|
.replace("var Module=typeof Module!==\"undefined\"?Module:{};", "var Module=typeof Module!==\"undefined\"?Module:{}; _module = Module")
|
||||||
.replace("{{RevisionName}}", revision);
|
.replace("{{RevisionName}}", revision);
|
||||||
|
|
||||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(frameworkFile))));
|
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(frameworkFile))));
|
||||||
|
@ -37,7 +37,7 @@ public class ReturnBytePatcher implements StreamReplacement {
|
|||||||
@Override
|
@Override
|
||||||
public boolean codeMatches(Func code) {
|
public boolean codeMatches(Func code) {
|
||||||
if (code.getLocalss().size() != 0) return false;
|
if (code.getLocalss().size() != 0) return false;
|
||||||
if (code.getExpression().getInstructions().size() != 30) return false;
|
if (code.getExpression().getInstructions().size() != 26) return false;
|
||||||
List<Instr> expr = code.getExpression().getInstructions();
|
List<Instr> expr = code.getExpression().getInstructions();
|
||||||
if (expr.get(expr.size() - 1).getInstrType() != InstrType.I32_XOR) return false;
|
if (expr.get(expr.size() - 1).getInstrType() != InstrType.I32_XOR) return false;
|
||||||
return true;
|
return true;
|
||||||
|
@ -20,7 +20,7 @@ let _gearth_incoming_copy;
|
|||||||
|
|
||||||
let _malloc;
|
let _malloc;
|
||||||
let _free;
|
let _free;
|
||||||
let Module;
|
let _module;
|
||||||
|
|
||||||
|
|
||||||
var packetBuff = {"out": [], "in": []};
|
var packetBuff = {"out": [], "in": []};
|
||||||
@ -98,10 +98,10 @@ function inject_out(packet) {
|
|||||||
let inject_amount = Math.min(_g_packet_split, packet.length - i);
|
let inject_amount = Math.min(_g_packet_split, packet.length - i);
|
||||||
|
|
||||||
let packet_location = _malloc(inject_amount + 16);
|
let packet_location = _malloc(inject_amount + 16);
|
||||||
Module.HEAPU8.set(out_packet_objid, packet_location);
|
_module.HEAPU8.set(out_packet_objid, packet_location);
|
||||||
Module.HEAPU8.fill(0, packet_location + 4, packet_location + 12);
|
_module.HEAPU8.fill(0, packet_location + 4, packet_location + 12);
|
||||||
Module.HEAPU8.set(writeLittleEndian(inject_amount), packet_location + 12);
|
_module.HEAPU8.set(writeLittleEndian(inject_amount), packet_location + 12);
|
||||||
Module.HEAPU8.set(packet.slice(i, i + inject_amount), packet_location + 16);
|
_module.HEAPU8.set(packet.slice(i, i + inject_amount), packet_location + 16);
|
||||||
|
|
||||||
_gearth_outgoing_copy(out_send_param1, packet_location, out_send_param3);
|
_gearth_outgoing_copy(out_send_param1, packet_location, out_send_param3);
|
||||||
_free(packet_location);
|
_free(packet_location);
|
||||||
@ -129,8 +129,8 @@ function inject_in(packet) {
|
|||||||
let inject_amount = Math.min(_g_packet_split, packet.length - i);
|
let inject_amount = Math.min(_g_packet_split, packet.length - i);
|
||||||
|
|
||||||
let packet_location = _malloc(inject_amount + 16);
|
let packet_location = _malloc(inject_amount + 16);
|
||||||
Module.HEAPU8.set(in_packet_prefix, packet_location);
|
_module.HEAPU8.set(in_packet_prefix, packet_location);
|
||||||
Module.HEAPU8.set(packet.slice(i, i + inject_amount), packet_location + 16);
|
_module.HEAPU8.set(packet.slice(i, i + inject_amount), packet_location + 16);
|
||||||
|
|
||||||
_gearth_incoming_copy(in_recv_param1, packet_location, 0, inject_amount, 0);
|
_gearth_incoming_copy(in_recv_param1, packet_location, 0, inject_amount, 0);
|
||||||
_free(packet_location);
|
_free(packet_location);
|
||||||
|
@ -30,27 +30,20 @@ function g_incoming_packet(param1, param2, param3, param4, param5) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// function g_chacha_setkey(param1, param2, param3, param4) {
|
function g_chacha_setkey(param1, param2, param3, param4) {
|
||||||
// if (chachas.length === 2) {
|
if (chachas.length === 2) {
|
||||||
// chachas = [];
|
chachas = [];
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// chachas.push(param1);
|
chachas.push(param1);
|
||||||
// }
|
}
|
||||||
|
|
||||||
function g_chacha_returnbyte(param1, param2, param3) {
|
function g_chacha_returnbyte(param1, param2, param3) {
|
||||||
console.log("hi");
|
|
||||||
chachaClass = param3;
|
chachaClass = param3;
|
||||||
if (chachas[0] === -1) {
|
|
||||||
chachas[0] = param1;
|
|
||||||
}
|
|
||||||
else if (chachas[1] === -1 && chachas[0] !== param1) {
|
|
||||||
chachas[1] = param1;
|
|
||||||
}
|
|
||||||
return param2;
|
return param2;
|
||||||
}
|
}
|
||||||
|
|
||||||
env["g_outgoing_packet"] = g_outgoing_packet;
|
env["g_outgoing_packet"] = g_outgoing_packet;
|
||||||
env["g_incoming_packet"] = g_incoming_packet;
|
env["g_incoming_packet"] = g_incoming_packet;
|
||||||
// env["g_chacha_setkey"] = g_chacha_setkey;
|
env["g_chacha_setkey"] = g_chacha_setkey;
|
||||||
env["g_chacha_returnbyte"] = g_chacha_returnbyte;
|
env["g_chacha_returnbyte"] = g_chacha_returnbyte;
|
Loading…
Reference in New Issue
Block a user