Skip to content

Commit

Permalink
Merge pull request #2 from Riremito/develop
Browse files Browse the repository at this point in the history
add config
  • Loading branch information
Riremito authored Jul 16, 2023
2 parents 504a8c4 + 35c51ae commit 7ca526e
Show file tree
Hide file tree
Showing 29 changed files with 1,487 additions and 112 deletions.
35 changes: 35 additions & 0 deletions EmuClient.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EmuExtra", "EmuExtra\EmuExt
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HeapTest", "HeapTest\HeapTest.vcxproj", "{8285A95C-AADA-4B1F-AE2C-80E2318700AE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SupportUTF8", "SupportUTF8\SupportUTF8.vcxproj", "{22175D3F-4576-47AB-9E29-0AAC8FA2EAC8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "x86_Extra", "x86_Extra", "{81218F0E-BB04-4E93-9875-CE7B17EB3DE2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EmuExtra_v20", "EmuExtra_v20\EmuExtra_v20.vcxproj", "{4794B654-944A-4263-9C87-011D13D67444}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StringPool", "StringPool\StringPool.vcxproj", "{6D5529B4-218F-4986-B0D7-CD55097054CC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand Down Expand Up @@ -92,6 +100,30 @@ Global
{8285A95C-AADA-4B1F-AE2C-80E2318700AE}.Release|x64.Build.0 = Release|Win32
{8285A95C-AADA-4B1F-AE2C-80E2318700AE}.Release|x86.ActiveCfg = Release|Win32
{8285A95C-AADA-4B1F-AE2C-80E2318700AE}.Release|x86.Build.0 = Release|Win32
{22175D3F-4576-47AB-9E29-0AAC8FA2EAC8}.Debug|x64.ActiveCfg = Debug|x64
{22175D3F-4576-47AB-9E29-0AAC8FA2EAC8}.Debug|x64.Build.0 = Debug|x64
{22175D3F-4576-47AB-9E29-0AAC8FA2EAC8}.Debug|x86.ActiveCfg = Debug|Win32
{22175D3F-4576-47AB-9E29-0AAC8FA2EAC8}.Debug|x86.Build.0 = Debug|Win32
{22175D3F-4576-47AB-9E29-0AAC8FA2EAC8}.Release|x64.ActiveCfg = Release|Win32
{22175D3F-4576-47AB-9E29-0AAC8FA2EAC8}.Release|x64.Build.0 = Release|Win32
{22175D3F-4576-47AB-9E29-0AAC8FA2EAC8}.Release|x86.ActiveCfg = Release|Win32
{22175D3F-4576-47AB-9E29-0AAC8FA2EAC8}.Release|x86.Build.0 = Release|Win32
{4794B654-944A-4263-9C87-011D13D67444}.Debug|x64.ActiveCfg = Debug|x64
{4794B654-944A-4263-9C87-011D13D67444}.Debug|x64.Build.0 = Debug|x64
{4794B654-944A-4263-9C87-011D13D67444}.Debug|x86.ActiveCfg = Debug|Win32
{4794B654-944A-4263-9C87-011D13D67444}.Debug|x86.Build.0 = Debug|Win32
{4794B654-944A-4263-9C87-011D13D67444}.Release|x64.ActiveCfg = Release|Win32
{4794B654-944A-4263-9C87-011D13D67444}.Release|x64.Build.0 = Release|Win32
{4794B654-944A-4263-9C87-011D13D67444}.Release|x86.ActiveCfg = Release|Win32
{4794B654-944A-4263-9C87-011D13D67444}.Release|x86.Build.0 = Release|Win32
{6D5529B4-218F-4986-B0D7-CD55097054CC}.Debug|x64.ActiveCfg = Debug|x64
{6D5529B4-218F-4986-B0D7-CD55097054CC}.Debug|x64.Build.0 = Debug|x64
{6D5529B4-218F-4986-B0D7-CD55097054CC}.Debug|x86.ActiveCfg = Debug|Win32
{6D5529B4-218F-4986-B0D7-CD55097054CC}.Debug|x86.Build.0 = Debug|Win32
{6D5529B4-218F-4986-B0D7-CD55097054CC}.Release|x64.ActiveCfg = Release|Win32
{6D5529B4-218F-4986-B0D7-CD55097054CC}.Release|x64.Build.0 = Release|Win32
{6D5529B4-218F-4986-B0D7-CD55097054CC}.Release|x86.ActiveCfg = Release|Win32
{6D5529B4-218F-4986-B0D7-CD55097054CC}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -105,6 +137,9 @@ Global
{007565B5-C36F-4878-904E-D43F28A2E7E2} = {968B385C-E96C-4D0D-8B88-29A5743D3143}
{ABDA27D6-7C53-4B03-BB51-798D902B8B52} = {08EA9CF7-04E8-4517-8900-3C0A5D73B539}
{8285A95C-AADA-4B1F-AE2C-80E2318700AE} = {08EA9CF7-04E8-4517-8900-3C0A5D73B539}
{22175D3F-4576-47AB-9E29-0AAC8FA2EAC8} = {08EA9CF7-04E8-4517-8900-3C0A5D73B539}
{4794B654-944A-4263-9C87-011D13D67444} = {81218F0E-BB04-4E93-9875-CE7B17EB3DE2}
{6D5529B4-218F-4986-B0D7-CD55097054CC} = {08EA9CF7-04E8-4517-8900-3C0A5D73B539}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {ADCAAC85-E7E1-46A6-989E-A0E379986E0C}
Expand Down
34 changes: 33 additions & 1 deletion EmuExtra/AobList.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,41 @@
#include<Windows.h>
#include<string>

std::wstring AOB_GMCommand[] = {
// v131.0
L"8A 80 ?? ?? ?? ?? A8 01 0F 84 ?? ?? ?? ?? 8D 45 ?? 50 68 ?? ?? ?? ?? 8D 45 ?? 50 8B CE E8",
};

std::wstring AOB_MapCommand[] = {
// v131.0
L"39 BE ?? ?? ?? ?? 75 12 E8 ?? ?? ?? ?? 2B 86 ?? ?? ?? ?? 3D F4 01 00 00 7D 07 33 C0 E9",
};

std::wstring AOB_GMChat[] = {
// v194.0
L"E8 ?? ?? ?? ?? 85 C0 74 ?? 6A ?? 8D 8D ?? ?? ?? ?? E8 ?? ?? ?? ?? C7 45 ?? ?? ?? ?? ?? E8",
// v186.1
L"E8 ?? ?? ?? ?? 85 C0 74 ?? 6A ?? 8D 8D 38 ?? ?? ?? ??",
L"E8 ?? ?? ?? ?? 85 C0 74 ?? 6A ?? 8D 8D 38", // to short
// v131.0
L"E8 ?? ?? ?? ?? 85 C0 74 ?? 57 6A ?? 8D 4D ?? E8",
};

// GM Command Lv1, /map, /chase, /pton
std::wstring AOB_GMCommand_v194_Lv1[] = {
// v194.0
L"E8 ?? ?? ?? ?? 8B 75 ?? A8 01 75 ?? 8B 45 ?? 8B 80 ?? ?? ?? ?? 3B C7 0F 84",
};

// /str, /dex, /int, /luk, /spget, /apget
std::wstring AOB_GMCommand_v194_Lv2[] = {
// v194.0
L"E8 ?? ?? ?? ?? 85 C0 0F 84 ?? ?? ?? ?? 8D 4D ?? 51 8D 55 ?? 52 8D 85 ?? ?? ?? ?? 68",
};

// /map, map list result
std::wstring AOB_GMCommandLocal_v194[] = {
// v194.0
L"E8 ?? ?? ?? ?? A8 01 75 ?? 83 BB ?? ?? ?? ?? 00 C7 45 ?? 00 00 00 00 74 ?? C7 45 ?? 01 00 00 00 8D 45 ?? 50 8D 8D ?? ?? ?? ?? 68",
};

std::wstring AOB_MapDropLimit[] = {
Expand Down
52 changes: 23 additions & 29 deletions EmuExtra/EmuExtra.cpp
Original file line number Diff line number Diff line change
@@ -1,40 +1,31 @@
#include"EmuExtra.h"
#include"AobList.h"

bool AobListScan(Rosemary &r, ULONG_PTR &result, std::wstring aob[], size_t count, int &used) {
result = 0; // scan result
used = -1; // which aob is used
for (size_t i = 0; i < count; i++) {
result = r.Scan(aob[i]);
if (result) {
used = (int)i;
return true;
}
}
return false;
}

#define PATCHDEBUG(func, patch) \
{\
ULONG_PTR u##func = 0;\
AobListScan(r, u##func, AOB_##func, _countof(AOB_##func), iWorkingAob);\
DEBUG(L""#func" = " + QWORDtoString(u##func) + L", Aob = " + std::to_wstring(iWorkingAob));\
if(u##func) {\
r.Patch(u##func, patch);\
}\
}

int conf_MapleVersion = 0;

void MemoryPatch() {
Rosemary r;
int iWorkingAob = 0; // do not change name

//DEBUG(L"MemoryPatch ver " + std::to_wstring(conf_MapleVersion));
PATCHDEBUG(GMChat, L"B8 01 00 00 00");
PATCHDEBUG(MapDropLimit, L"B8 00 00 00 00 90 90 90 90 90 90");
PATCHDEBUG(PointItemDropLimit, L"EB 2D 90 90 90 90");
PATCHDEBUG(PointItemMultipleDrop, L"B8 00 00 00 00");
// /+message is enabled
// vold
AOBPatch(GMCommand, L"B8 01 00 00 00 90");
AOBPatch(MapCommand, L"90 90 90 90 90 90 90 90");
// old-new
AOBPatch(GMChat, L"B8 01 00 00 00");
// new bigbang
AOBPatch(GMCommand_v194_Lv1, L"B8 01 00 00 00");
AOBPatch(GMCommand_v194_Lv2, L"B8 01 00 00 00");
AOBPatch(GMCommandLocal_v194, L"B8 01 00 00 00");


AOBPatch(MapDropLimit, L"B8 00 00 00 00 90 90 90 90 90 90");
AOBPatch(PointItemDropLimit, L"EB 2D 90 90 90 90");
AOBPatch(PointItemMultipleDrop, L"B8 00 00 00 00");
}

void MemoryPatchThread() {
MemoryPatch();
}


Expand All @@ -50,5 +41,8 @@ void EmuExtra(HMODULE hDll) {
conf_MapleVersion = std::stoi(wMapleVersion);
}
*/
MemoryPatch();
HANDLE hThread = CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)MemoryPatch, NULL, NULL, NULL);
if (hThread) {
CloseHandle(hThread);
}
}
108 changes: 108 additions & 0 deletions EmuExtra_v20/EmuExtra_v20.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#include"../Share/Simple/Simple.h"
#include"../Share/Hook/SimpleHook.h"

#pragma pack(push, 1)
// JMS v20
typedef struct {
BYTE unk1[0x70];
void *Platform; // 0x70
BYTE unk2[0x2C];
DWORD JumpFlag; // 0xA0
} MapleCharacterObject;

typedef struct {
BYTE unk1[0x3C];
MapleCharacterObject * Object; // 0x3C
BYTE unk2[0x3A0];
int X; // 0x3E0
int Y; // 0x3E4
/*
struct Teleport {
int toggle; // 0x3F8
int x; // 0x400
int y; // 0x404
};
*/
} MapleCharacter;
#pragma pack(pop)

MapleCharacter **MyCharacter = (decltype(MyCharacter))0x0065F40C;
void(__stdcall *_TeleportObject)(MapleCharacterObject *, int X, int Y) = (decltype(_TeleportObject))0x005B17A0;
WCHAR *JumpSoundName = (decltype(JumpSoundName))0x0065B91C;
void (*_PlaySound)(WCHAR *, int) = (decltype(_PlaySound))0x00599380;

void (__thiscall *_MoveCharacter)(MapleCharacterObject *, DWORD) = NULL;
void __fastcall MoveCharacter_Hook(MapleCharacterObject *Object, void *edx, DWORD dwCommand) {
MapleCharacter *character = (MapleCharacter *)(*(DWORD *)0x0065F40C);
if (character->Object == Object && Object->JumpFlag && Object->Platform) {
// DOWN ARROW key, Key Down
if (GetAsyncKeyState(VK_DOWN) & 0x8000) {
if (character) {
Object->JumpFlag = 0; // clear flag
_PlaySound(JumpSoundName, 100); // jump SE
_TeleportObject(Object, character->X, character->Y + 5); // teleport
return; // do not call original
}
}
}
// original
_MoveCharacter(Object, dwCommand);
}

void MemoryPatch() {
Rosemary r;

// MapleStory AcGuardian Bypass
r.Patch(0x005D147D, L"EB");
r.Patch(0x005D15C5, L"90 90 90 90 90");
r.Patch(0x004FC0D0, L"C3");
r.Patch(0x005D37FA, L"90 90 90 90 90");
r.Patch(0x005D3801, L"90 90 90 90 90");
r.Patch(0x005D4664, L"EB");
r.Patch(0x005D5511, L"90 90 90 90 90");
// Japanese OS CP Check Bypass
r.Patch(0x005D15A1, L"90 90");
r.Patch(0x005D15AE, L"90 90");
// Enable Multi-Client
r.Patch(0x005D14CA, L"EB");
// Enable Window Mode
r.Patch(0x005D47AE + 7, L"00 00 00 00");
// Modifying Client Resolution
//r.Patch(0x005D487C + 1, L"00 04 00 00"); // 1024
//r.Patch(0x005D486D + 1, L"00 03 00 00"); // 768
// Enable Droppable NX
r.Patch(0x0048613B, L"90 90 90 90 90 90");
r.Patch(0x00486147, L"90 90 90 90 90 90");
// Re-Enable Admin Actions
r.Patch(0x004860AF, L"EB");
r.Patch(0x0052A0BC, L"EB");
r.Patch(0x005E0681, L"EB");
r.Patch(0x00497604, L"EB");
// Enable Cash Shop
r.Patch(0x00463900, L"C2 04 00"); //idk
// Fix Pets
// Fix Messengers

// Add Jump Down
SHookFunction(MoveCharacter, 0x005ACBF0);
}

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
{
DisableThreadLibraryCalls(hinstDLL);
MemoryPatch();
break;
}
case DLL_PROCESS_DETACH:
{
break;
}
default:
{
break;
}
}
return TRUE;
}
Loading

0 comments on commit 7ca526e

Please sign in to comment.