marco-sacchi / RLoader

DOS programs launcher with customizable lists, search and thumbnails display.
MIT License
24 stars 1 forks source link

RLoader.exe eat an entire segment causing a lot of games don't run #14

Closed cyberluke closed 3 years ago

cyberluke commented 3 years ago

Hi, thank you for a great launcher. In order to use it, there is one thing a bit problematic:

These games run without issues if I exit RLoader, but inside RLoader they fail to run and you are returned back to RLoader menu. Did you have a chance to try any of these? I have like 622kb of free conventional memory. I tried EMS/XMS as well. One game (Cannon Fodder) prints that there is not enough memory to run inside RLoader. But it will run without RLoader right after I exit RLoader.

I tried to run it several times and use Pause key to get print screen for you. It happens on native machine as well as in DosBox. cannon_fodder

This quite famous DOS games won't run: 1) Lotus 2) Lost Vikings 3) Cannon Fodder 4) Alone In The Dark 5) Chaos Engine 6) Skyroads

Interesting is that Doom and Command & Conquer will run. The list is bigger, this is just what I remember now. It might be there is something residential that cause the issues or some vector has been modified and DOS4GW will have a problem (something that some file managers can cause - like Norton Commander).

I think the only solution for this would be to have some BAT file automatically run after you exit RLoader. When you choose game, RLoader would overwrite this BAT file to contain launch information for that game and then exit itself. This way it would work on principle of simple BAT file launching a game, nothing resident in memory. Because as you said, it takes only about 11kb of memory (if I remember correctly)...so the problem might be in Borland compiler itself and the way how it works with memory. There might be some magic compiler parameter or some smart workaround on a code level. But right now it will run only a few games.

marco-sacchi commented 3 years ago

This quite famous DOS games won't run:

  1. Lotus: I don't have it
  2. Lost Vikings: dont' run
  3. Cannon Fodder: run ok
  4. Alone In The Dark: I don't have it
  5. Chaos Engine: I don't have it
  6. Skyroads: run ok

This is part of the list I checked to see which games work with RLoader on DOSBox ECE r4444 (and almost certainly also in vanilla DOSBox):

# path      executable      setup           cycles  title                               RLoader
e:\3dkit    kit.exe         -                    0  3D construction kit                 Ok
e:\3dkit2   3dmake.exe      3dsetup.exe          0  3D construction kit 2               Ok
e:\4dboxing 4dboxing.bat    setup.exe        20000  4D sports: boxing                   Ok
e:\4ddrive  stunts.com      setup.exe        16000  4D sports: driving                  Ok
e:\abuse    abuse.exe       setup.exe        20000  Abuse                               Ok
e:\aladdin  aladdin.exe     setsnd.exe           0  Aladdin                             -
e:\alleycat alleycat.exe    -                 9000  Alley cat                           Ok
e:\another  another.exe     config.exe       20000  Another world                       Ok
e:\aoe      aoe.com         install.exe          0  Ace over europe                     -
e:\arcadevb av.exe          -                 6000  Arcade Volleyball                   Ok
e:\arkanoid start.bat       -                 9000  Arkanoid II: Revenge of DoH         Ok
e:\awaves   alpha.bat       -                 5000  Alpha waves                         Ok
e:\baron    baron.com       install.com          0  Red baron                           Ok
f:\batman   batman.exe      setsound.exe     20000  Batman forever                      Ok
e:\bchess   chess.exe       -                 8000  Battle Chess (VGA - protected)      Ok
e:\bchess_e chess.exe       -                 8000  Battle Chess                        Ok
e:\bcracers bcracers.exe    setup.exe        16000  Bc racers                           Ok
e:\beach    start.bat       -                20000  Kings of the beach                  Ok
e:\bigtop   go.bat          -                  500  Big top                             -
e:\blake    bstone.bat      -                20000  Blake Stone: Aliens of golds        Ok
e:\blockout bl.exe          -                20000  Block out                           Ok
e:\bodyblow bb.exe          -                60000  Body blow                           Ok
e:\bootcamp runme.bat       -                 5000  Boot camp                           Ok
e:\boxing   boxing.com      -                    0  Championship boxing                 Ok
e:\brothers runme.exe       -                 1000  The blues brothers                  Ok
e:\bthorne  bthorne.bat     setup.exe        20000  Black thorne                        Ok
e:\buckzoom zoom.com        -                 1000  Buck rogers: planet of doom         Ok
e:\budokan  budo.com        -                    0  Budokan the martial spirit          Ok
e:\bushido  bushido.exe     -                  500  Bushido: the Way of the Warrior     Ok
f:\c&c      command.bat     setup.com            0  Command and Conquer                 -
e:\caesar   caesar.bat      install.exe       2500  Caesar                              Ok
f:\caesar2  c2.bat          setsound.exe         0  Caesar II                           Ok
e:\carnage  carnage.exe     -                    0  Carnage                             Ok
e:\calgames go.bat          -                20000  California games                    Ok
e:\cannon   cannon.bat      install.exe      15000  Cannon fodder                       Ok
e:\cannon2  cannon.exe      install.exe      15000  Cannon fodder 2                     Ok
f:\carpet   carpet.exe      -                25000  Magic carpet                        Ok
e:\cd-man2  cdman2.exe      -                    0  CD-MAN 2.0                          Ok
e:\cgames2  cgii.exe        -                    0  California games II                 Ok
e:\chess88  chess.exe       -                    0  IBM Chess                           Ok
e:\colonize colonize.bat    install.exe       5000  Colonization                        Ok
e:\comanche comanche.exe    soundset.exe     20000  Comanche: maximum overkill          -
e:\coolspot spot.exe        setsnd.exe        5000  Coolspot                            -
e:\crazycar crazycar.com    -                    0  Crazy cars                          -
e:\crimewav cw.exe          -                15000  Crime wave                          -

I had tried to use DOSBox-X too in the past, but if you just want to play old games maybe you should use DOSBox ECE or vanilla DOSBox without installing freeDOS (if I remember correctly you had freeDOS) because they have a memory manager that allows you to have almost all 640Kb of free base memory.

Interesting is that Doom and Command & Conquer will run. The list is bigger, this is just what I remember now. It might be there is something residential that cause the issues or some vector has been modified and DOS4GW will have a problem (something that some file managers can cause - like Norton Commander).

All programs in protected-mode work with RLoader because it is in real-mode and the resident part does not implement any changes to the interrupt vector table.

Other real-mode programs need required base memory to be free.

I will release an update in the next few hours with some minor improvements and startup parameters that will facilitate troubleshotting. Like display the memory status (through the mem /free command, and the insertion of the pause command at the launched program exit in order to view the output on the screen that would otherwise be impossible to read.

The solution I was thinking about is to write the resident part of RLoader (RLOADER.EXE) in assembly in order to minimize the size of the executable and leave more base memory free for the programs that are launched.

cyberluke commented 3 years ago

Ahh, forget that Dosbox-X stuff. That was just example. I am primarily running on actual hardware (386DX, Am5x86 and Pentium 133 MMX). tuning2

All of them, including DOSBox, have this issue with games I mention above.

I did look in the source code today. I see the changes. I have downloaded Borland C++ 5.02 which is the latest with DOS support. It installs on Windows 10, but your PRJ project fails to load. I guess it is incompatible and I would need to boot Win98 machine and get 3.00 going.

Yes and I'm a big Comanche fan and it's not working :-D I have even original boxed copy. That one does not work as well. So in the end I can use this software only to look for screenshots when I'm bored or I don't remember the games. Then, in 40% of my cases, I need to type the commands myself :-) ...and I have 3 real computers, they have between 620kb and 630kb of free conventional memory. None of the use cases will pass. All these games will fail in the same way. Which is why I'm wondering it might not be free conventional memory issue.

marco-sacchi commented 3 years ago

I did look in the source code today. I see the changes. I have downloaded Borland C++ 5.02 which is the latest with DOS support. It installs on Windows 10, but your PRJ project fails to load. I guess it is incompatible and I would need to boot Win98 machine and get 3.00 going.

You can use VirtualBox, create a virtual machine with MS-DOS or freeDOS and install Borland C++ 3.1 there. I've been using it for months to develop, debug and test RLoader and others utilities without any problems.

cyberluke commented 3 years ago

No need, I have Dual P-III with Voodoo 2 SLI right here using FPGA scanline converter on Samsung QLED 55 inch TV :-D ....I don't like virtual machines. Windows 98 is freaking fast there with SSD drive. But good to know FreeDOS supports it, that is also my favourite OS. But right now I'm fixing also Teensy active USB to PC AT keyboard converter and GoTEK FlashFloppy firmware, so it is quite busy weekend.

cyberluke commented 3 years ago

Before 79FED717-03D1-498D-9501-25AE1C42CF9B

After exiting Rloader

replicated on three computers, ms dos 6.22

Terminator T2: same issue

cyberluke commented 3 years ago

Your app takes 70kb

cyberluke commented 3 years ago

After exiting Rloader (im on phone) B92E5F59-EF7D-484D-8598-2827F34B24FC

cyberluke commented 3 years ago

FUN FACT: executing: LH rloader.exe

Will load to upper memmory, which will be completely full and then it eats only 10kb.

It is kinda experimental, but it works. All games work, even the most demanding Chaos Engine. Lotus, Skyroads work.

I guess Dosbox will load high for you, which is kind of a hack.

marco-sacchi commented 3 years ago

Your app takes 70kb

True, I have now checked by calling the mem /free command from inside rloader.exe (the persistent executable) before loading the ui.exe file and the available RAM drops by about 70kb.

This eliminates any memory leak problems, it is simply the rloader.exe executable which seems to occupy an entire segment (64kb).

I am investigating to verify if this is a normal behavior of .exe files and possibly change strategy.

cyberluke commented 3 years ago

With LH command, it will load high and at least it works for now. Thank you!

I don't think it is normal because cd-rom and soundcard drivers are exe and are not doing this. I would be curious to compile this under Borland 5.02 compiler, but I will have time next weekend.

I remember it happened to me also with RLoader text only version. But I should double check that, this could eliminate some BMP pictures memory or caching issue.

But it's going the right direction! I have mentioned RLoader in few Facebook retro gaming groups and people like it. Perhaps only if there could be at least 64 color images for faster computers in the future.

marco-sacchi commented 3 years ago

With LH command, it will load high and at least it works for now. Thank you!

It works, but having a smaller executable, or with a smaller RAM footprint when loaded, would make it easier to load it into high memory.

LH loads an executable into conventional memory if there is not enough high memory without displaying any messages. To be sure that the command was successful you need to inspect the RAM with mem /D, which in this case is not possible.

I don't think it is normal because cd-rom and soundcard drivers are exe and are not doing this. I would be curious to compile this under Borland 5.02 compiler, but I will have time next weekend.

The drivers are all TSR executables (terminate and stay resident), this type of executable requires the programmer to specify to DOS how many paragraphs of memory to keep persistent before terminate, optimizing the RAM occupation.

I remember it happened to me also with RLoader text only version. But I should double check that, this could eliminate some BMP pictures memory or caching issue.

It certainly happens also with the text interface, because the memory you see currently occupied is that of rloader.exe not of ui.exe (the graphical / textual user-interface).

But it's going the right direction! I have mentioned RLoader in few Facebook retro gaming groups and people like it. Perhaps only if there could be at least 64 color images for faster computers in the future.

Thank you so much for making RLoader known even in non-specific forums or social networks like Vogons!

64-color images have no advantage in terms of implementation. A 256-color (8-bit-per-pixel) video mode is still required to display a 64-color (6-bit-per-pixel) image.

I had chosen to limit the thumbnails to 16 colors in order to be able to use a video mode compatible with VGA cards (640x480 at 16 colors), so if I really decided to increase the available color depth I would definitely choose some mode-X like (320x240 at 256 colors) to maintain the maximum requirement of a compatible VGA graphics card instead of VESA SVGA. I specified VESA because it is the only way to avoid chip-specific implementations by having a standard linear framebuffer interface.

256 colors modes are easier to manage because there is no need to do bit-level calculations (1 byte == 1 pixel) so they definitely don't need more computing power.


Searching I had confirmation that by default the .exe files with tiny memory model and the .com files by default occupy an entire segment (64kb).

The Borland compiler, however, allows through global variables to set the maximum size of the heap and of the stack. By doing some tests I managed to reduce the RAM footprint of rloader.exe to 18.752 bytes (tested with mem /free command).

I haven't committed yet because I want to look for more information.

cyberluke commented 3 years ago

Hi, how r u? Do u need any help?

marco-sacchi commented 3 years ago

Now rloader.exe take 1.520 bytes of effective ram marked as occupied, but the memory drop reported using mem /free is of 6.384‬ bytes.

marco-sacchi commented 3 years ago

Hi, how r u? Do u need any help?

Not for now thanks, everything is ok.

But if you could re-test the games you mentioned earlier, using the new version 1.0.2, and RLOADER and LH RLOADER as launch commands, that would be nice, so I can close this issue.

marco-sacchi commented 3 years ago

Aside from the higher than calculated ram usage, rloader.exe now actually allows programs that use more conventional memory to run.

cyberluke commented 3 years ago

Thank you, I will retest this week. But I guess it will be ok.

cyberluke commented 3 years ago

Hi, it is running. The game that were causing problems are working right now.

There is still one bug: right now you cannot use LH (load high) command for Rloader. It will quit with fatal error. Something about unable to parse list.txt file (games) or allocation error. Without LH, it works.

marco-sacchi commented 3 years ago

Hi, it is running. The game that were causing problems are working right now.

There is still one bug: right now you cannot use LH (load high) command for Rloader. It will quit with fatal error. Something about unable to parse list.txt file (games) or allocation error. Without LH, it works.

It is strange, I have checked again both in the development VM, with the three memory managers I have (EMM386, UMBPCI and QEMM 97), and on DOSBox and I have no errors in either case.

Can you post the full text of the error on the issue #16?

I close this issue since now rloader.exe no longer occupies an entire memory segment.