Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: cheatX_address in .cht files are inconsistent between DOSBox-pure versions #548

Open
AleWin32 opened this issue Nov 10, 2024 · 4 comments

Comments

@AleWin32
Copy link

I have created some .cht files for some very basic DOS games.

Cheats always work for all the executions of the games I do (the addresses are always the same, so looks they are not allocated dynamically and are allocated in the stack).

But if i update my Batocera 0.38 distro:
(RetroArch 1.15.0 and DOSBox-pure 0.9.7 with default options)
to:
(RetroArch 1.18.0 and DOSBox-pure 0.9.9 with default options)

the addresses remain inusable because they have changed between DOSBox-pure versions.

For example in Batocera 0.38, it was:
cheat0_address = "628757"

but for the same cheat in Batocera 0.40 now it must be:
cheat0_address = "44565"

This will make all the .cht files that use addresses for DOSBox-pure unusable, how can this be solved? Is there any solution?

Or is there a way to calculate the final address depending on DOSBox-pure version? or using relative adresses (relative to the memory for the game starts) instead of absolute ones?

@schellingb
Copy link
Owner

Unfortunately 0.9.8 had to change the layout of the memory blocks reported to the frontend. This was done to provide more stable memory addresses. Before certain configuration options (like audio settings) could affect where in memory a game would store its data.
Both DOS and DOSBox aren't really well suited for these things. But there have been steps made towards supporting achievements with RetroAchievements which certainly will require memory addresses to be stable on all platforms. Once we get there, cheats also should be stable. I just don't know exactly when that will be.

It should be possible for you to subtract 584192 (628757 - 44565) on every address you have found to update for 0.9.9?

@AleWin32
Copy link
Author

AleWin32 commented Nov 13, 2024

Sorry @schellingb but i don't have the .cht files anymore :-( This was a problem i had months ago so i have posted it now, and i only have tested it with one memory address i have found.

So do you think is technically possible to maintain the same memory address for all future versions of DOSBox-pure? How is this possible if the memory blocks are going to change across versions? Will not the solution be to expose only the memory that the game "see" and not the full memory (some kind of relative memory)?

@schellingb
Copy link
Owner

It's not that simple with DOS. DOS is an operating system that does offer memory management functionality. On a real computer running real DOS, switching the DOS version, changing system settings or changing drivers or driver settings would lead to memory of games getting laid out differently in RAM. Similarly with DOSBox, if some part of the DOS emulation is changed, or certain emulation settings are modified, the memory locations given to a game by DOS can then change.

So recent efforts have been made to better protect against this going forward. The memory exposed for cheats by DOSBox Pure is split into 3 blocks:

  • The part of the conventional memory used by the hardware (BIOS) and OS (DOS) emulation
  • The part of the conventional memory used by the game below 640 kb
  • All remaining memory (upper and extended memory)

That very first block can change in size between versions of the core (or between different versions of DOSBox) and also depending on certain system settings. To avoid issues, DOSBox Pure now exposes these 3 blocks of memory independently to the libretro frontend so a change in the BIOS/OS area doesn't affect where the game's memory ends up at.

  • The part of the conventional memory used by the game is at address 0x00000000
  • The part of the conventional memory used by the BIOS/DOS is at address 0x00100000
  • The remaining memory is at address 0x00200000

This doesn't solve all issues because DOS extender memory management will act different depending on the amount of conventional memory available to the game. So there is still a possibility for things to shift around but hopefully less.

@AleWin32
Copy link
Author

Thanks @schellingb for your explanation.

I will check if in the next version of DOSBox-pure, memory adresses are still the same. Tell me if you need to so some testing with games with this thing, i'm very interested in it to be improved.

Having a stable memory address across DOSBox-pure versions will allow us to upload DOS game cheats and make them work, at least for the most simple games that does not use extended/expanded/... memory schemes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants