source: Daodan/src/Daodan.c@ 839

Last change on this file since 839 was 839, checked in by alloc, 12 years ago

Daodan:

  • Fixes #42
  • Breaking out patches to own file
File size: 1.7 KB
RevLine 
[692]1#include <windows.h>
[346]2#include <string.h>
[838]3#include <stdio.h>
[346]4
[272]5#include "Daodan.h"
6#include "Daodan_Patch.h"
7#include "Daodan_Utility.h"
[339]8#include "Daodan_Cheater.h"
[439]9#include "Daodan_BSL.h"
[476]10#include "Daodan_Console.h"
[838]11#include "Daodan_Config.h"
[839]12#include "patches/Patches.h"
[349]13
[273]14#include "Oni.h"
[339]15
[692]16#include "Oni_GL.h"
[272]17
18HMODULE DDrDLLModule;
19HMODULE DDrONiModule;
20
[693]21
[838]22void __cdecl DDrMain(int argc, char* argv[])
23{
24 DDrStartupMessage("Daodan: Daodan attached!");
[452]25
[838]26 DDrConfig(argc, argv);
27
[839]28 DD_Patch_Init();
[838]29
30
[705]31 ONiMain(argc, argv);
[273]32}
[465]33/*
34void DDrWrongExe()
35{
36 switch (MessageBox(NULL, "This version of the Daodan DLL is incompatible with your Oni.exe.\n"
37 "Click OK for more information. To continue using Oni without the patch, replace the downloaded binkw32.dll with the original.", "Daodan", MB_OKCANCEL | MB_ICONERROR))
38 {
39 case IDOK:
40 {
41 STARTUPINFO si;
42 PROCESS_INFORMATION pi;
43 FillMemory(&si, 0, sizeof(si));
44 FillMemory(&pi, 0, sizeof(pi));
45 si.cb = sizeof(si);
46 if (!CreateProcess(NULL, "cmd /c \"start http://wiki.oni2.net/Daodan_DLL\"", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
47 MessageBox(NULL, "", "", 0);
48 CloseHandle(pi.hProcess);
49 CloseHandle(pi.hThread);
50 }
51 default:
52 ExitProcess(0);
53 }
54}
55*/
[272]56BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
57{
58 switch (fdwReason)
59 {
60 case DLL_PROCESS_ATTACH:
61 DDrDLLModule = hinstDLL;
62 DDrONiModule = GetModuleHandle(NULL);
63
[677]64 if (*(uint32_t*)(OniExe + 0x0011acd0) == 0x09d36852)
[689]65 DDrPatch_MakeCall((void*)(OniExe + 0x0010fb49), (void*)DDrMain);
[465]66 else
67 ExitProcess(0);
[272]68 break;
69 }
70 return TRUE;
71}
Note: See TracBrowser for help on using the repository browser.