[Bug] Custom maps not loading with cache preloading

ImageNeed any help? Do you have a problem? Ask us! We will help you!
Post Reply
jormaig
Posts: 4
Joined: 01 Dec 2022, 10:56
Been thanked: 1 time

[Bug] Custom maps not loading with cache preloading

Post by jormaig »

So I've just found this issue when testing the "Advanced Cache Preloading" feature.

Steps to reproduce:
1. Enable "Advanced Cache Preloading"
2. Start game
3. Single player
4. Skirmish
5. Try to open a custom map
6. Screen stays blank and nothing seems to happen

My current patch version is 1.5.9.002 on Windows 11 21H2 (22000.1281)
If you need any more info just ask.

Thank you very much for your amazing work!
These users thanked the author jormaig for the post:
Dr.MonaLisa

User avatar
Dr.MonaLisa
High Representative
Posts: 8746
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 109 times

Re: [Bug] Custom maps not loading with cache preloading

Post by Dr.MonaLisa »

Hi jormaig.

I'm aware of this problem. It usually fixes itself after using ALT+TAB, or ALT+ENTER (switching between the fullscreen and the windowed mode). Sometimes need to do this multiple times. It also affects the other boxes, like selecting a saved game, selecting a playback file to watch, etc.

This is one of the very mysterious issues and I think it will never be fixed. It's probably related to the higher memory usage of the game process, which obviously can't be reduced with the Advanced Cache Preloading (since it was created especially to fill up RAM to reduce mini-lags). So sadly ACP will most likely remain BETA for long, if not forever.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
jormaig
Posts: 4
Joined: 01 Dec 2022, 10:56
Been thanked: 1 time

Re: [Bug] Custom maps not loading with cache preloading

Post by jormaig »

Ah I see! Thank you very much for your reply Dr.MonaLisa! I'm curious in how your dev setup works with this game. Did you make a post somewhere? I find it super cool that you kind of opened the game and started adding things :D
User avatar
Dr.MonaLisa
High Representative
Posts: 8746
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 109 times

Re: [Bug] Custom maps not loading with cache preloading

Post by Dr.MonaLisa »

What exactly would you like to know? The setup in meaning of the software, or computer hardware specs?
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
jormaig
Posts: 4
Joined: 01 Dec 2022, 10:56
Been thanked: 1 time

Re: [Bug] Custom maps not loading with cache preloading

Post by jormaig »

Sorry, software setup. I'm also a c++ developer so I was curious
User avatar
Dr.MonaLisa
High Representative
Posts: 8746
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 109 times

Re: [Bug] Custom maps not loading with cache preloading

Post by Dr.MonaLisa »

Hmm... I only use Visual Studio 2022. However, with EE2 it's usually not about C++, but assembly. I like the old-fashioned OllyDbg program. I know that there is x64dbg, but I just got used to the old one for EE2. After all, the program is not as important as knowledge of EE2 addresses, and "finding myself" in that compiled code.

I recorded some videos from the assembling process:





It only shows a very little part. In total there are around 400-700 assembly changes in game made with UP1.5. This number includes some minor fixes of existing... fixes. Generally, assembling is very time consuming and stressful. I prefer changes and features that can be done by the Launcher or GameHelper.dll without injecting code, but these are possible rather rarely now.
What's satisfying is that there is (hopefully) not much left to do. The last bothering thing was the multi-monitor support for me. With 1.5.9 it works pretty well.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
jormaig
Posts: 4
Joined: 01 Dec 2022, 10:56
Been thanked: 1 time

Re: [Bug] Custom maps not loading with cache preloading

Post by jormaig »

Oh wow that's amazing! Thanks for sharing!
User avatar
Dr.MonaLisa
High Representative
Posts: 8746
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 109 times

Re: [Bug] Custom maps not loading with cache preloading

Post by Dr.MonaLisa »

Hi jormaig and Bogdan. I have good news, I fixed this problem, and I know what caused it.

When Large Address Aware option is enabled, the game can use more than 2GB of RAM. However, addresses above 2GB are negative numbers.
The game was calling function MSVCRT_findfirst to check if the folder exists. It always returned the address, but the game was checking this address with "TEST EAX,EAX" which returned "false" when the address was higher than 2GB.
I fixed it by checking if the return of this function is "-1" which is the only possible fail code from it.
EE2 Original function: 0x00A51A0F
TEST EAX,EAX
POP EDI
POP ESI
POP EBP
MOV EAX,EBX
JGE SHORT 00A51A1B
MOV BYTE PTR DS:[EBX],1
POP EBX
ADD ESP,200
RETN 8
HEX:
85 C0 5F 5E 5D 8B C3 7D 03 C6 03 01 5B 81 C4 00 02 00 00 C2 08 00 90 90 90 90 90 90 90 90 90 90 90
Fixed:
CMP EAX,-1
POP EDI
POP ESI
POP EBP
MOV EAX,EBX
; REMEMBER THAT SHORT CHANGED
JNE SHORT 00A51A1C
MOV BYTE PTR DS:[EBX],1
POP EBX
ADD ESP,200
RETN 8

83 F8 FF 5F 5E 5D 89 D8 75 03 C6 03 01 5B 81 C4 00 02 00 00 C2 08 00 90 90 90 90 90 90 90 90 90 90
This issue will be natively fixed in the next version. However, not to force you to wait for the release, I added this fix to the Unofficial Patch 1.5 Keep Alive Live Update system. This means, that if you have a working Internet connection, the Launcher will automatically apply this fix, and the Load / Save menu should always display files. It potentially fixes some other issues in game, which depended on this function.

So in simple words: enable ACP, start the game and it should be working fine on your current version.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
User avatar
Bogdan
Posts: 149
Joined: 25 Feb 2017, 17:26
Location: Kyiv, Ukraine
Been thanked: 3 times

Re: [Bug] Custom maps not loading with cache preloading

Post by Bogdan »

Hi Mona, indeed this fixes scenario and map choosing window!
I can now use advanced cache preloading again :D
These users thanked the author Bogdan for the post:
Dr.MonaLisa
Post Reply

Return to “Help, Questions & Problems. Empire Earth II Support.”