Skip to content

Posts from Heroes 3 on a dual-core processor.

No ratings yet — be the first to rate!
18 years ago
Auto-translated
I'm playing HOMM 3 Armageddon's Blade, and my processor is running at 100%, the laptop fan is constantly on, and if I run it on battery, it only lasts about 40 minutes :-(

Are there any patches for Heroes that fix this issue, or do I have to write them myself?
User Avatar
18 years ago
Auto-translated
Questions: What is the laptop's system?
18 years ago
Auto-translated
IBM (Lenovo), Celeron-M processor, approximately 1500 MHz.
18 years ago
Auto-translated
It's not about the game itself. Maybe you're playing on a wool blanket? Or perhaps you've blocked the fans with something? It could just be overheating.
In reply to Монца
18 years ago
Auto-translated
Monza;110538
It's not about the game itself. Maybe you're playing on a wool blanket? Or perhaps you've covered the fans with something? It could simply be overheating.

My main concern is the 100% CPU usage; everything else is a consequence of the CPU being loaded at 100%.
Moreover, this high CPU usage occurs not only on a laptop but also on desktop computers.
User Avatar
18 years ago
Auto-translated
So, does the game installed from this disc load the processors at 100%?
In reply to Inquisitor
18 years ago
Auto-translated
Inquisitor;110796
So, the game installed from this disc loads the processors at 100%?
One processor (one core) is loaded to 100%. It's just that the disc was purchased a long time ago. Maybe I'm behind the times, and there are some patches... :-)
User Avatar
18 years ago
Auto-translated
This happened for the first time since p166. There are no patches of this kind, and there cannot be. Here's one piece of advice: try buying a new copy of Heroes III: Armageddon's Blade.
In reply to Inquisitor
18 years ago
Auto-translated
Another feature of my version is that artifacts have 4 slots instead of 5. More precisely, there are 5, but one is invisible. Let's say 4 slots are occupied, we take some kind of sphere of preservation, and that's it, it goes into the 5th slot, and you can't remove it :-)

By the way, I solved the loading problem, albeit in a rather awkward way. If, for every 5-10 calls of the IsIconic function, you call sleep(1) once, then the loading time for the professor drops to 1-3%. In general, it's a hack, I'll keep looking for a better version...
In reply to ezhfan
User Avatar
18 years ago
Auto-translated
Try installing Everest Professional and see how it performs and what you get. It's 100% not feasible; on my PII 350, Heroes ran smoothly, along with Winamp and everything else...
Try buying a disc; it's not expensive. I saw Armageddon's Blade for 80 to 100 rubles in St. Petersburg...
For a licensed disc, it's nothing...
And there will be no glitches, and it's better to get The Shadow of Death; you can install anything on it, disable the disc requirement, and do everything else...
In reply to ewgeniy
18 years ago
Auto-translated
ewgeniy;111450
Try installing Everest Professional and see what happens. It's 100% impossible; on my PII 350, Heroes ran smoothly, along with Winamp and everything else...
Try buying a disc; it's not expensive. I saw Armageddon's Blade for 80 to 100 rubles in St. Petersburg...
That's nothing for a licensed disc...
And there won't be any glitches, and it's better to get The Shadow of Death; you can do anything with it, remove the disc requirement, and so on...

It's definitely possible – there's an infinite loop running without any waits. Since there's no fifth slot for artifacts, I suspect that the Heroes version isn't entirely legitimate. :smile15: Anyway, I'll go to the Savelyevsky market tomorrow, buy a "Bukovskaya" version, and let you know how it goes.
18 years ago
Auto-translated
The adventures continue. I installed the "platinum" edition of Heroes, and it crashes frequently. I've realized that I seem to have particularly bad luck, but I'll keep fighting until the end :-)
In reply to ezhfan
18 years ago
Auto-translated
So, I've solved all the problems :-) I'll tell you everything in order: 1) I installed Armageddon's Blade, and then installed The Shadow of Death on top of it (in the same folder). I updated The Shadow of Death. Random maps are now generated. 2) I disabled the second processor core. (In Device Manager, I replaced the ACPI Multiprocessor PC driver with ACPI Uniprocessor PC). As a result, the game no longer crashes (or freezes). 3) I wrote a DLL for the game that, for every 10 calls to the IsIconic function, makes one call to sleep(1). The result is that the processor load is 1-3%. In general, thank you all for your help :-)
18 years ago
Auto-translated
As requested, I will describe the process in more detail.
I must immediately state that the resulting product has every right to crash Windows, and I am not responsible if someone hasn't closed an MS Office document or has added this thing to the startup.
I rewrote the code because the original version was intended for a specific version of Heroes 3. I borrowed a lot of code from wasm.ru, especially from http://wasm.ru/article.php?article=apihook_1

How does it work? It's simple. The prog.exe application calls the set_hook function from the syshook.dll library. This could be any application that has a Windows message processing queue.
Next, the set_hook function, located in the DLL (a requirement of MSDN for system hooks), sets a hook on WH_CBT. This could be any other system hook. Events for this hook are processed by the SysMsgProc stub function. Why like this? Because we don't need the hook itself – we need to load into the address space of all applications with windows, especially Heroes.
We could have added this DLL to the registry so that it would automatically load into all applications, but I'm not perfect and I think I made a lot of mistakes. In general, to prevent the system from crashing, it's better not to do that.

When loaded, the DLL searches for the syshook.ini file in the folder from which the process was launched. The first line of this file should contain a regular expression that matches the name of the launched file, and the second line should indicate how many times to call sleep(1) when calling IsIconic.

I won't talk about the injection mechanism here – read the article; everything is clear there.

If someone says that the main procedure of the DLL should have handled unloading correctly, I will note that I wanted the program to compile on everyone's Delphi 6, and there is an error in system.pas that prevents correct handling of load/unload events. The stack is broken.

So, how does it work? There should be a syshook.ini file in the Heroes folder (an example is attached in the archive). Run the program (prog.exe), wait 3 seconds; it should write something, then run Heroes. Do not close the program.

P.S.: It would be possible to make a simpler and less clumsy solution – to modify the Heroes executable, but this is already a creative process and individual for each specific version of Heroes.

P.P.S.: In addition to the binaries, the archive also contains the source code so that those who wish can compile it as much as they want. Open the dpr files in Delphi; I compiled it in Delphi 6, you can open and compile it in Delphi 7.
The DLL and the executable are compiled separately.

Sorry for the rambling description and poor programming style – I didn't get much sleep
Attachments 1
1 file attached • Total size: 461.5 KB
18 years ago
Auto-translated
And I'll add a few words about the errors in the program:
1) The Hook variable in the CallNextHookEx function is likely incorrect (undefined). I don't think this is a critical error.
2) The new function that replaces IsIconic is not reentrant, i.e., if you start calling it from two threads at the same time, it will cause problems (but Heroes III won't do that). For other programs, you need to come up with something to synchronize (using, for example, InterlockedExchange).
3) The injection method used is also not ideal - for Heroes, you could have made a launcher (and there would be no need to mess around with DLLs and hooks). But then the program would not be universal, and it would not be possible to modify it so that, for example, it could launch Starcraft (because it is launched by a loader).
4) The lack of comments speaks for itself. However, if anyone asks anything, I will answer (if I don't disappear from the forum).
5) The speed of the program could be increased if, instead of ReadProcessMemory and WriteProcessMemory, you used reading and writing memory "directly," after first opening access using VirtualProtect.
6) Opening the process with PROCESS_ALL_ACCESS rights is also a mistake; it won't always work if the user has limited rights.
7) I'm even afraid to imagine how it will work under Windows Vista :eek:. However, it's probably Microsoft's problem and the guy who's in charge of Vista.:D

Statistics

Welcome our newest member: recijeb