ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/src/Daodan.c
(Generate patch)

Comparing Daodan/src/Daodan.c (file contents):
Revision 690 by alloc, Wed Mar 6 18:33:15 2013 UTC vs.
Revision 694 by alloc, Fri Mar 8 00:31:30 2013 UTC

# Line 1 | Line 1
1 + #include <windows.h>
2   #include <string.h>
3  
4   #include "Daodan.h"
# Line 11 | Line 12
12   #include "Daodan_WindowHack.h"
13  
14   #include "Oni.h"
14 #include "Oni_Persistence.h"
15  
16 < #include "BFW_Utility.h"
16 > #include "Oni_GL.h"
17 > #include "Daodan_GL.h"
18  
19 < #include "oni_gl.h"
19 < #include "daodan_gl.h"
20 <
21 < #include "inifile.h"
19 > #include "Inifile_Reader.h"
20  
21   HMODULE DDrDLLModule;
22   HMODULE DDrONiModule;
# Line 41 | Line 39 | bool patch_argb8888 = true;
39   bool patch_killvtune = true;
40   bool patch_getcmdline = true;
41   bool patch_disablecmdline = true;
42 + bool patch_optionsvisible = true;
43  
44   bool patch_safeprintf = true;
45   bool patch_daodandisplayenum = true;
# Line 58 | Line 57 | bool opt_topmost = false;
57  
58   typedef int (__cdecl *CHINESEPROC)(DWORD WINAPI);
59   bool patch_chinese = false;
60 +
61 +
62 +
63 + void ONICALL DDrShowResumeButton(int window, int visibility)
64 + {
65 +        if (visibility)
66 +                WMrWindow_SetLocation(window, 150, 350);
67 +        WMrWindow_SetVisible(window, visibility);
68 + }
69 +
70 +
71 + /* Options always visible patch */
72 + void ONICALL DDrShowOptionsButton(int window, int visibility)
73 + {
74 +        WMrWindow_SetVisible(window, 1);
75 + }
76 +
77 +
78 +
79   bool DDrPatch_Init()
80   {
81          DDrStartupMessage("patching engine");
# Line 236 | Line 254 | bool DDrPatch_Init()
254          
255          if(patch_chinese)
256          {
257 +                DDrStartupMessage("Loading chinese DLL");
258                  HMODULE dll = LoadLibrary("xfhsm_oni.dll");
259 +                DWORD err = GetLastError();
260 +                DDrStartupMessage(" - Module loading returned error %i", err);
261                  if( dll )
262                  {
263                          void* proc = GetProcAddress( dll, "InstallHook" );
# Line 281 | Line 302 | bool DDrPatch_Init()
302  
303   //FLATLINE?     DDrPatch_MakeCall((void*)(OniExe + 0x000C26CB), FLrHook_DoorOpen);
304   //FLATLINE?     DDrPatch_MakeCall((void*)(OniExe + 0x000EE3CF), FLrHook_ConsoleActivate);
305 +
306 +
307 +        // Fix options not visible in main menu when a game was started
308 +        if(patch_optionsvisible)
309 +        {
310 +                DDrPatch_MakeCall((void*)(OniExe + 0x000d2d2d), DDrShowOptionsButton);
311 +                DDrPatch_MakeCall((void*)(OniExe + 0x000d2d43), DDrShowResumeButton);
312 +        }
313 +
314          return true;
315   }
316  
317 +
318   enum {s_unknown, s_options, s_patch, s_bsl, s_language} ini_section;
319  
320   bool DDrIniCallback(char* section, bool newsection, char* name, char* value)
# Line 328 | Line 359 | bool DDrIniCallback(char* section, bool
359                                  opt_sound = !_stricmp(inifile_cleanstr(value), "true");
360                          else if (!_stricmp(name, "switch"))
361                                  M3gResolutionSwitch = !_stricmp(inifile_cleanstr(value), "true");
331                        //else if (!_stricmp(name, "devmode"))
332                                //turn_dev_mode_on = !_stricmp(inifile_cleanstr(value), "true");
362                          else
363                                  DDrStartupMessage("unrecognised option \"%s\"", name);
364                          break;
# Line 390 | Line 419 | bool DDrIniCallback(char* section, bool
419                                  patch_cheater = !_stricmp(inifile_cleanstr(value), "true");
420                          else if (!_stricmp(name, "newweap"))
421                                  patch_newweapon = !_stricmp(inifile_cleanstr(value), "true");
422 +                        else if (!_stricmp(name, "optionsvisible"))
423 +                                patch_optionsvisible = !_stricmp(inifile_cleanstr(value), "true");
424                          else
425                                  DDrStartupMessage("unrecognised patch \"%s\"", name);
426                          break;
# Line 680 | Line 711 | void __cdecl DDrMain(int argc, char* arg
711                  DDrPatch_MakeJump((void*)(OniExe + 0x0010f021), (void*)DDrCheater_LevelLoad);
712          }
713  
683        //DDrPatch_MakeJump((void*)(OniExe + 0x000378c0, (void*)DDrException);
714          DDrPatch_MakeJump((void*)(OniExe + 0x000245A0), (void*)DDrPrintWarning);
685        //init_daodan_gl();
715          
716          ONiMain(argc, argv);
717   }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)