I don't know why joaquim did not document it from the start. I think you can find reference on this forum, but yeah include should add a note about it.
If you know the address, you should probably use directly OrpheuMemorySetAtAddress, more straight, but probably doesn't matter that much using OrpheuMemoryReplaceAtAddress as long the count is set to 1.
In your previous you're using count at 0, meaning replacing all found strings.
If you want to keep track of where memory has been patched, you will need to loop and saving address.
Like (totally unchecked):
EDIT: The following would be just the safe way because you know the address before patched and restore string no matter what is current content. I'm showing you just for the sake to understand.
You could actually probably just OrpheuMemoryReplace with reversed string like : OrpheuMemoryReplace("modString",0,"common/menu1.wav", "common/wpn_denyselect.wav") ; it should work too.
Code:
new Array:addressesList = ArrayCreate();
new const originalString[] = "common/wpn_denyselect.wav";
new const replacedString[] = "common/menu1.wav";
new const memoryIdentifier[] = "modString";
const replacementCount = 1;
new startAddress = OrpheuGetLibraryAddress("mod");
new lastAddress;
// PATCH
while (OrpheuMemoryReplaceAtAddress(startAddress, memoryIdentifier, replacementCount, originalString, replacedString, lastAddress))
{
startAddress = lastAddress + sizeof(originalString); // Said +4 because thought by default of an address which on 4 bytes. Here size of string, though it's not really needed.
ArrayPushCell(addressesList, lastAddress);
}
// UNPATCH
for (new i = 0, size = ArraySize(addressesList); i < size; ++i)
{
OrpheuMemorySetAtAddress(ArrayGetCell(addressesList, i), memoryIdentifier, replacementCount, originalString);
}
__________________