- Joined
- Oct 29, 2007
- Messages
- 1,292
- Reaction score
- 1,314
Hello Today I come to let the source code for 3D camera + mini-maps + sky, where i was working this last time... (that is nothing but a compilation of other sources) + Offsets for main.exe v1.07P+
Nemesis.cpp
PS: That person and / or people who want to contribute to this source, are free to set about it, because the truth I'm new to all this Programming Language C++, so it is acceptable that mistakes are...
Credits: FOR ALL MU ONLINE COMMUNITY
DLL Compiled 3D Camera + Mini-Maps + Sky:
Special Credits to: Sobieh, ZergNM, Leo123, vcorp,MyGSFun, Mulegend, chris05, SirMaster (Old ASM Programmer & A Good Friend)
Nemesis.cpp
Code:
[COLOR="Blue"]#include <cstdlib>
#include <iostream>
#include "Stdafx.h"
#include "Nemesis.h"
#include "Sky.h"
extern "C" _declspec(dllexport) void Init()
{
DWORD OldProtect;
if(VirtualProtect(LPVOID(0x401000),4310016,PAGE_EXECUTE_READWRITE,&OldProtect))
{
KeyboardSetHook(true);
MouseSetHook(true);
}
else {
MessageBoxA(NULL,"Cannot load Nemesis.dll","Mu Online",MB_OK);
}
}
int APIENTRY DllMain (HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved){
switch(dwReason){
case DLL_PROCESS_DETACH:
KeyboardSetHook(false);
MouseSetHook(false);
break;
}
return true;
}
BOOL KeyboardSetHook(BOOL set_or_remove){
if(set_or_remove == TRUE){
if(KeyboardHook == NULL){
KeyboardHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)KeyboardProc, hInstance, GetCurrentThreadId());
if(!KeyboardHook){ return FALSE; }
}
} else {
return UnhookWindowsHookEx(KeyboardHook);
KeyboardHook = NULL;
}
return TRUE;
}
BOOL MouseSetHook(BOOL set_or_remove){
if(set_or_remove == TRUE){
if(MouseHook == NULL){
MouseHook = SetWindowsHookEx(WH_MOUSE, MouseProc, hInstance, GetCurrentThreadId());
if(!MouseHook){ return FALSE; }
}
} else { return UnhookWindowsHookEx(MouseHook); }
return TRUE;
}
LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam){
if(((lParam>>31)&1) && (nCode == HC_ACTION)){
if(wParam == VK_END){
*Camera_RotY = -48.5;
*Camera_RotZ = -45;
*Camera_PosZ = 150;
*Camera_ClipX = 1190;
*Camera_ClipY = 2400;
*Camera_GlClip = 3000;
*Camera_Zoom = 35;
}
if(wParam == VK_HOME){
if(!InitCamera)
{ InitCamera = true;
} else {
InitCamera = false;
}
}
}
return CallNextHookEx(KeyboardHook, nCode, wParam, lParam);
}
LRESULT CALLBACK MouseProc(int code, WPARAM wParam, LPARAM lParam){
MOUSEHOOKSTRUCTEX* mhs = (MOUSEHOOKSTRUCTEX*)lParam;
HWND MuWnd = FindWindow(TEXT("MU"), NULL);
if(GetForegroundWindow() == MuWnd){
if(InitCamera == true){
Camera.ClipX = *Camera_ClipX;
Camera.ClipY = *Camera_ClipY;
Camera.GlClip = *Camera_GlClip;
Camera.PosZ = *Camera_PosZ;
Camera.RotY = *Camera_RotY;
Camera.RotZ = *Camera_RotZ;
Camera.Zoom = *Camera_Zoom;
}
if(InitCamera == true) {
if(wParam == WM_MBUTTONDOWN){
MoveCamera = true;
}
if(wParam == WM_MBUTTONUP){
MoveCamera = false;
}
if(wParam == WM_MOUSEWHEEL){
int direction = mhs->mouseData;
if(direction > 0){
if(*Camera_Zoom < 60){ *Camera_Zoom += 2; }
}
else if(direction < 0){
if(*Camera_Zoom > 12){ *Camera_Zoom -= 2; }
}
*Camera_ClipX = 1190 + (abs(*Camera_PosZ - 150) * 3) + 3000;
*Camera_ClipY = 2400 + (abs(*Camera_PosZ - 150) * 3) + 3000;
*Camera_GlClip = 3000 + (abs(*Camera_PosZ - 150) * 3) + 1500;
}
else if(wParam == WM_MBUTTONDOWN){
MouseX = mhs->pt.x;
MouseY = mhs->pt.y;
}
else if(wParam == WM_MOUSEMOVE){
if(MoveCamera){
if(MouseX < mhs->pt.x){
*Camera_RotZ += 8;
if (*Camera_RotZ > 315) *Camera_RotZ = -45;
}
else if(MouseX > mhs->pt.x){
*Camera_RotZ -= 8;
if (*Camera_RotZ < -405) *Camera_RotZ = -45;
}
if(MouseY < mhs->pt.y){
if(*Camera_RotY < -45){
*Camera_PosZ -= 44;
*Camera_RotY += (float)2.42;
}
}
else if(MouseY > mhs->pt.y){
if(*Camera_RotY > -90){
*Camera_PosZ += 44;
*Camera_RotY -= (float)2.42;
}
}
MouseX = mhs->pt.x;
MouseY = mhs->pt.y;
*Camera_ClipX = 1190 + (abs(*Camera_PosZ - 150) * 3) + 6000;
*Camera_ClipY = 2400 + (abs(*Camera_PosZ - 150) * 3) + 4000;
*Camera_GlClip = 3000 + (abs(*Camera_PosZ - 150) * 3) + 1500;
}
}
}
}
return CallNextHookEx(MouseHook, code, wParam, lParam);
}
struct FRGB
{
float r, g, b;
};
AUX_RGBImageRec* blankimage;
AUX_RGBImageRec* images[32][6];
unsigned int textures[32][6];
int skycolordirection;
int DisplayInitialized, MiniMapInitialized;
FRGB skycolor;
typedef int(*TSkyHook)();
TSkyHook SkyHook = (TSkyHook) 0x4A8F9E;
typedef int(*TBlend) (int);
TBlend Blend = (TBlend) 0x626570;
int *MainState = (int*)0x915D44;
int *Map = (int*)0x61E97D; //Mini-Map Main 1.07P+ Research by Nemesis
typedef int(*TUnBlend) ();
TUnBlend UnBlend = (TUnBlend) 0x6264F1;
int Sky = GetPrivateProfileIntA("Nemesis", "Sky", 0, ".\\Nemesis.ini");
int SkyDayNight = GetPrivateProfileIntA("Nemesis", "SkyTimer", 0, ".\\Nemesis.ini");
bool FileExists(char * name)
{
if(CreateFile(name,0,0,0,OPEN_EXISTING,0,0) == INVALID_HANDLE_VALUE)
return false;
return true;
}
void GetCamCoords(double* x_cam, double* y_cam, double* z_cam)
{
double m[16];
glGetDoublev(GL_MODELVIEW_MATRIX, m);
*x_cam = -m[12] * m[0] - m[13] * m[1] - m[14] * m[2];
*y_cam = -m[12] * m[4] - m[13] * m[5] - m[14] * m[6];
*z_cam = -m[12] * m[8] - m[13] * m[9] - m[14] * m[10];
}
void ChangeSky()
{
SYSTEMTIME sm;
GetLocalTime(&sm);
int hourstate = sm.wHour % 2;
float minutestate = (float)sm.wMinute / 60.0f;
if(hourstate == 0)
{
skycolor.r = minutestate;
skycolor.g = minutestate;
skycolor.b = minutestate;
}
else
{
skycolor.r = 1.0f - minutestate;
skycolor.g = 1.0f - minutestate;
skycolor.b = 1.0f - minutestate;
}
}
void CALLBACK SkyTimerProc(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime)
{
ChangeSky();
}
void InitDisplay()
{
SetTimer(FindWindow(TEXT("MU"), NULL),3,60000,(TIMERPROC)
int(Sky));
{
char texturepath[256];
sprintf_s(texturepath,"%s",".\\Data\\Sky\\Null.bmp");
if(!FileExists(texturepath))
{
MessageBox(0,"Cannot find Null.bmp","Error",0);
ExitProcess(0);
}
blankimage = auxDIBImageLoad(texturepath);
try
{
for(int i=0 ; i<30; i++)
{
for(int j=0; j<6; j++)
{
images[i][j] = blankimage;
}
sprintf_s(texturepath,".\\Data\\Sky\\World%d\\Back.bmp",i+1);
if(FileExists(texturepath))
images[i][0] = auxDIBImageLoad(texturepath);
sprintf_s(texturepath,".\\Data\\Sky\\World%d\\Bottom.bmp",i+1);
if(FileExists(texturepath))
images[i][1] = auxDIBImageLoad(texturepath);
sprintf_s(texturepath,".\\Data\\Sky\\World%d\\Front.bmp",i+1);
if(FileExists(texturepath))
images[i][2] = auxDIBImageLoad(texturepath);
sprintf_s(texturepath,".\\Data\\Sky\\World%d\\Left.bmp",i+1);
if(FileExists(texturepath))
images[i][3] = auxDIBImageLoad(texturepath);
sprintf_s(texturepath,".\\Data\\Sky\\World%d\\Right.bmp",i+1);
if(FileExists(texturepath))
images[i][4] = auxDIBImageLoad(texturepath);
sprintf_s(texturepath,".\\Data\\Sky\\World%d\\Top.bmp",i+1);
if(FileExists(texturepath))
images[i][5] = auxDIBImageLoad(texturepath);
}
}
catch(...){}
for(int i=0 ; i<30; i++)
{
for(int j=0; j<6; j++)
{
glGenTextures(1, &textures[i][j]);
glBindTexture(GL_TEXTURE_2D, textures[i][j]);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D, 0, 3, images[i][j]->sizeX, images[i][j]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, images[i][j]->data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
}
skycolor.r = 1.0f;
skycolor.g = 1.0f;
skycolor.b = 1.0f;
if(SkyDayNight)
{
skycolordirection = 1;
SetTimer(FindWindow(TEXT("MU"), NULL),2,5000,(TIMERPROC)SkyTimerProc);
ChangeSky();
}
}
DisplayInitialized = 1;
}
bool CanDrawSky()
{
char texturepath[256];
sprintf_s(texturepath,".\\Data\\Sky\\World%d\\Top.bmp",*Map+1);
if(FileExists(texturepath))
return true;
return false;
}
void Display()
{
SkyHook();
*MainState = 5;
if(*MainState == 5/* && !unhautorized*/)
{
if(!DisplayInitialized)
InitDisplay();
if(Sky && CanDrawSky())
{
double x_cam, y_cam, z_cam;
GetCamCoords(&x_cam,&y_cam,&z_cam);
Blend(1);
glColor3d(skycolor.r,skycolor.g,skycolor.b);
glBindTexture(GL_TEXTURE_2D, textures[*Map][5]);
glBegin(GL_QUADS);
//TOP
glTexCoord2f(1.0f, 0.0f); glVertex3d(x_cam-3000, y_cam+3000, 1500);
glTexCoord2f(0.0f, 0.0f); glVertex3d(x_cam+3000, y_cam+3000, 1500);
glTexCoord2f(0.0f, 1.0f); glVertex3d(x_cam+3000, y_cam-3000, 1500);
glTexCoord2f(1.0f, 1.0f); glVertex3d(x_cam-3000, y_cam-3000, 1500);
glEnd();
glBindTexture(GL_TEXTURE_2D, textures[*Map][1]);
glBegin(GL_QUADS);
//BOTTOM
glTexCoord2f(1.0f, 1.0f); glVertex3d(x_cam-3000, y_cam+3000, 0);
glTexCoord2f(0.0f, 1.0f); glVertex3d(x_cam+3000, y_cam+3000, 0);
glTexCoord2f(0.0f, 0.0f); glVertex3d(x_cam+3000, y_cam-3000, 0);
glTexCoord2f(1.0f, 0.0f); glVertex3d(x_cam-3000, y_cam-3000, 0);
glEnd();
glBindTexture(GL_TEXTURE_2D, textures[*Map][2]);
glBegin(GL_QUADS);
//FRONT
glTexCoord2f(1.0f, 1.0f); glVertex3d(x_cam-3000, y_cam+3000, 1500);
glTexCoord2f(0.0f, 1.0f); glVertex3d(x_cam+3000, y_cam+3000, 1500);
glTexCoord2f(0.0f, 0.0f); glVertex3d(x_cam+3000, y_cam+3000, 0);
glTexCoord2f(1.0f, 0.0f); glVertex3d(x_cam-3000, y_cam+3000, 0);
glEnd();
glBindTexture(GL_TEXTURE_2D, textures[*Map][0]);
glBegin(GL_QUADS);
//BACK
glTexCoord2f(0.0f, 1.0f); glVertex3d(x_cam-3000, y_cam-3000, 1500);
glTexCoord2f(1.0f, 1.0f); glVertex3d(x_cam+3000, y_cam-3000, 1500);
glTexCoord2f(1.0f, 0.0f); glVertex3d(x_cam+3000, y_cam-3000, 0);
glTexCoord2f(0.0f, 0.0f); glVertex3d(x_cam-3000, y_cam-3000, 0);
glEnd();
glBindTexture(GL_TEXTURE_2D, textures[*Map][3]);
glBegin(GL_QUADS);
//LEFT
glTexCoord2f(1.0f, 1.0f); glVertex3d(x_cam-3000, y_cam-3000, 1500);
glTexCoord2f(0.0f, 1.0f); glVertex3d(x_cam-3000, y_cam+3000, 1500);
glTexCoord2f(0.0f, 0.0f); glVertex3d(x_cam-3000, y_cam+3000, 0);
glTexCoord2f(1.0f, 0.0f); glVertex3d(x_cam-3000, y_cam-3000, 0);
glEnd();
glBindTexture(GL_TEXTURE_2D, textures[*Map][4]);
glBegin(GL_QUADS);
//RIGHT
glTexCoord2f(0.0f, 1.0f); glVertex3d(x_cam+3000, y_cam-3000, 1500);
glTexCoord2f(1.0f, 1.0f); glVertex3d(x_cam+3000, y_cam+3000, 1500);
glTexCoord2f(1.0f, 0.0f); glVertex3d(x_cam+3000, y_cam+3000, 0);
glTexCoord2f(0.0f, 0.0f); glVertex3d(x_cam+3000, y_cam-3000, 0);
glEnd();
UnBlend();
}
}
}
void HookExactOffset(DWORD my, DWORD tohook, BYTE type)
{
*(BYTE*)tohook = type;
*(DWORD*)(tohook+1) = my;
}
void HookThis(DWORD dwMyFuncOffset,DWORD dwJmpOffset)
{
*(DWORD*)(dwJmpOffset+1)=dwMyFuncOffset-(dwJmpOffset+5);
}
void ChangePath(const char* Map, ...)
{
memcpy((DWORD*)0x931AF0,Map,17);
HookExactOffset(0x931AF0,0x00711AD5,0x68);
}
void LoadImageJgpForMap(char* ImagePatch, DWORD PrintCode)
{
_asm
{
Mov Edi, 0x006F329E
Push 0x1
Push 0x2900
Push 0x2601
Push 0x7B69
Push 0x931AF0
Call Edi
Add Esp,0x14
}
}
int LoadMap(int Map)
{
char FullMapName[200];
sprintf_s(FullMapName,"World%d\\Map1.jpg",Map+1);
ChangePath(FullMapName);
LoadImageJgpForMap(FullMapName, 0x7B69);
return Map;
}
bool MapChecker1(int Map)
{
if( Map == 0 || Map == 1 || Map == 2 || Map == 3 || Map == 4 || Map == 7 || Map == 8 ||
Map == 10 || Map == 24 || Map == 30 || Map == 33 || Map == 34 || Map == 37 || Map == 38 ||
Map == 41 || Map == 51 || Map == 56 || Map == 57 || Map == 63)
{
return 1;
}
return 0;
}
char FullMapName[200];
void MapChecker2(int Map)
{
if( Map == 0 || Map == 1 || Map == 2 || Map == 3 || Map == 4 || Map == 7 || Map == 8 ||
Map == 10 || Map == 24 || Map == 30 || Map == 33 || Map == 34 || Map == 37 || Map == 38 ||
Map == 41 || Map == 51 || Map == 56 || Map == 57 || Map == 63)
{
LoadMap(Map);
_asm
{
MOV EDI, 0x007B61D6
CALL EDI
MOV ECX,EAX
MOV EDI, 0x007B6564
CALL EDI
MOV ECX,EAX
MOV EDI, 0x0070FBCE
CALL EDI
}
Sleep(100);
}
else if( Map == 77 || Map == 78)
{
*(BYTE*)(0x0070FB69) = 0x75;
}
else
{
*(BYTE*)(0x0070FB69) = 0x75;
}
}
void MiniLoad()
{
int Map;
char FullMapName[200];
Map = *(unsigned char*)0x0091A3E4;
if( Map == 0 || Map == 1 || Map == 2 || Map == 3 || Map == 4 || Map == 7 || Map == 8 ||
Map == 10 || Map == 24 || Map == 30 || Map == 33 || Map == 34 || Map == 37 || Map == 38 ||
Map == 41 || Map == 51 || Map == 56 || Map == 57 || Map == 63)
{
sprintf_s(FullMapName,"World%d\\Map1.jpg",Map+1);
*(BYTE*)(0x00707647) = 0xEB;
memcpy((DWORD*)0x91CD90,FullMapName,17);
}
else if( Map == 77 || Map == 78)
{
*(BYTE*)(0x0070FB69) = 0x75;
}
else
{
*(BYTE*)(0x0070FB69) = 0x75;
}
}
void MiniMap()
{
*(BYTE*)(0x007680DD) = 0x90;
*(BYTE*)(0x007680DD+1) = 0x90;
HookThis((DWORD)&MapChecker1, 0x0070FB5A);
HookThis((DWORD)&MapChecker2, 0x0061E97D);
}[/COLOR]
You must be registered to see links
PS: That person and / or people who want to contribute to this source, are free to set about it, because the truth I'm new to all this Programming Language C++, so it is acceptable that mistakes are...
Credits: FOR ALL MU ONLINE COMMUNITY
DLL Compiled 3D Camera + Mini-Maps + Sky:
You must be registered to see links
Special Credits to: Sobieh, ZergNM, Leo123, vcorp,MyGSFun, Mulegend, chris05, SirMaster (Old ASM Programmer & A Good Friend)
Last edited: