Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Commit

Permalink
Added AlwaysLoadClientPlugins patch
Browse files Browse the repository at this point in the history
  • Loading branch information
secretdataz committed Feb 5, 2018
1 parent ab6930f commit d599734
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
47 changes: 47 additions & 0 deletions Patches/AlwaysLoadClientPlugins.qs
@@ -0,0 +1,47 @@
// Purpose: To make the client load client plug-in libraries regardless of its sound settings.
// Author: Secret <secret@rathena.org>
// To-do: See if it has any undesirable side effect

function AlwaysLoadClientPlugins() {
// Step 1a - Find SOUNDMODE
var offset = exe.findString("SOUNDMODE", RVA);
if (offset === -1)
return "Failed in Step 1 - SOUNDMODE not found";

// Step 1b - Find its reference
offset = exe.findCode("68" + offset.packToHex(4), PTYPE_HEX, false);
if (offset === -1)
return "Failed in Step 1 - SOUNDMODE reference not found";

// Step 2a - Fetch soundMode variable location
var code =
" 68 AB AB AB 00" // PUSH soundMode
+ " 8D 45 AB" // LEA EAX, [EBP+Type]
+ " 50" // PUSH EAX
+ " 6A 00" // PUSH 0
;
offset = exe.find(code, PTYPE_HEX, true, "\xAB", offset - 0x10, offset);

if (offset === -1)
return "Failed in Step 2 - Argument pushes for call to RegQueryValueEx not found";

var soundMode = exe.fetchHex(offset + 1, 4);

// Step 3a - Find soundMode comparison
code =
" 8D 40 04" // LEA EAX, [EAX+4]
+ " 49" // DEC ECX
+ " 75 AB" // JNZ _loop
+ " 39 0D" + soundMode // CMP soundMode, ECX
;
offset = exe.findCode(code, PTYPE_HEX, true, "\xAB");

if (offset === -1)
return "Failed in Step 3 - soundMode comparison not found";

offset += code.hexlength();

exe.replace(offset, " 90".repeat(6), PTYPE_HEX);

return true;
}
2 changes: 2 additions & 0 deletions Patches/_patchlist.qs
Expand Up @@ -374,3 +374,5 @@ registerPatch(235, "EnableMerceSkills", "Enable Custom Mercenary Skills [Experim
registerPatch(236, "IgnoreAccountArgument", "Ignore /account: command line argument", "Fix", 0, "Secret", "Makes the client ignore /account: command line argument to prevent custom clientinfo.xml from being used.", false);

registerPatch(237, "LoadCustomClientInfo", "Load custom ClientInfo file", "Custom", 0, "Secret", "Makes the client load your own clientinfo file instead of *clientinfo.xml", false);

registerPatch(237, "AlwaysLoadClientPlugins", "Always Load Client Plugins", "Fix", 0, "Secret", "Makes the client load client plug-ins regardless of its sound settings", false);

0 comments on commit d599734

Please sign in to comment.