View Full Version : Tutorial: Changing League Structures (with DDraw.dll)

14-05-19, 03:38 PM
Tutorial how to use DDraw.dll wrapper to change (or create???) league structures in cm01/02.
Possible this solution have more potential.

Tools needed:
Ida Free (https://www.hex-rays.com/products/ida/support/download_freeware.shtml)
x64dbg (https://x64dbg.com) (Newest version of Olly)
Visual Studio Community (https://docs.microsoft.com/pl-pl/visualstudio/releasenotes/vs2017-relnotes)

Source code of DDraw.dll:
DDrawWrapper (https://www4.zippyshare.com/v/E7vX8AEH/file.html)

Source code with added polish first and second division with some changes as example.
Change relegation to 3 without playoff-s. Disable dividing points.

1.Open cm01/02 in IDA
Go to Windows->Strings window
Find the (ctrl+F) pol_first.cpp. Double click on them.
Select the name of address (eg. aEDevCpp....) and press X.
Click first on the list, and go to begin of function SUB_7C8A80.
You can rename this name to own (press N on that name).

Find line:

mov dword ptr [esi], offset off_96E360

Select the off_96E360 and press Enter or Alt+Enter (to open in new tab).
This is begin of pointer table of polish first division
Pointer table is 45 addresses of function. Part of them is this same for all leagues/divisions.
Next off_96E414 is Polish League Cup, next Polish Second Divison etc.
For another nation template is this same.

2. Copy function from IDA to Visual Studio.
Check example how its this working.
Some function must be replaces:

mov eax, dword_9CF858

must be changed to:

mov eax, 0x9cf858
mov eax, [eax]

More examples in source.

Don't change anything yet.

3. Write in DDraw.dll function to replace orginal addresses with new to your function

4. Compile DDraw.dll
Fix the compile errors, and function errors.
Edit DDraw.ini file or remove from DDraw code.
Open DDraw in IDA and compare your functions with orginal.
Beware the stack. (push / pop)

5. Test with x64dbg or Olly
Copy compiled ddraw.dll to cm0102.exe main directory.
Probably the cm0102 will crash. Go to 4.

6. Make changes and go to 5.

Have fun.

15-05-19, 12:35 AM
this is amazing and has a huge potential, thanks a lot for sharing ! :ok: