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

SDL2 issue with multiple mapper files #3821

Closed
2 tasks done
github-fanuser opened this issue Nov 11, 2022 · 32 comments
Closed
2 tasks done

SDL2 issue with multiple mapper files #3821

github-fanuser opened this issue Nov 11, 2022 · 32 comments
Labels

Comments

@github-fanuser
Copy link

github-fanuser commented Nov 11, 2022

Question

I apologize if this question has already been asked and answered.
I have several games that require mapping configurations. I have save these to different map files. Is there a way to load a map file after dosbox starts? If not, is this a feature that can be added in the future?

P.S. There has not been a new release since Sep. What is happening?

Thanks.

Have you checked that no similar question(s) exist?

  • I have searched and didn't find any similar question.

Code of Conduct & Contributing Guidelines

  • I agree to follow the code of conduct and the contributing guidelines.
@maron2000
Copy link
Contributor

There are plenty of useful information in the Wiki before asking questions.
https://github.com/joncampbell123/dosbox-x/wiki#dosbox-xs-mapper-editor

@github-fanuser
Copy link
Author

I know how to use the mapper editor. I was asking if there was a way to load a specific map file after DOSBox started. I guess the answer to my question is no. Perhaps, this can be an added feature.

@maron2000
Copy link
Contributor

@NebularNerd
Copy link
Contributor

There is a mapperfile entry in the dosbox.conf files, I've not tried it yet but you should be able to load it inside DosBox-X using:
config -set "mapperfile=pathtomapperfile\mapperfile", at worst you could load it from the command line with dosbox -set "mapperfile=pathtomapperfile\mapperfile" which you could use in a batch or bash file.

@aybe
Copy link
Collaborator

aybe commented Nov 12, 2022

@github-fanuser

DOSBox-X is continuously delivered

I have pinned the explanations on how to download it.

Load another mapper file

ACDSeeQVUltimate16_tz2ROBqbto

Also possible from the .conf file:

[sdl]
mapperfile = your_mapper_file.map

@github-fanuser
Copy link
Author

Is there a command I can run in a .bat file that will load a map file and then run the game? If not, then this may be a nice feature to add, if possible. Thanks.

@NebularNerd
Copy link
Contributor

Is there a command I can run in a .bat file that will load a map file and then run the game? If not, then this may be a nice feature to add, if possible. Thanks.

You can run a bat file either inside or outside of dosbox-x to set the mapper, from my last comment you could create a .bat file similar to the following.

Outside dosbox-x, example:

dosbox-x -set "mapperfile=pathtomapperfile\mapperfile" -mount c "dosboxgames" -c "cd gamefolder" -c "game.exe"

Inside dosbox-x, example:

config -set "mapperfile=pathtomapperfile\mapperfile"
cd gamefolder
game.exe

Both would work the same, it depends on how you prefer to work. For my setup I tend to do as much inside dosbox-x as I can, essentially every game is started through a play.bat which sets handles mounting CD images, setting graphics modes and so forth. There are a few things you cannot do on the fly inside like setting Tandy or Gravis but there is loads you can do. Most options in the .conf file can be adjusted using the -set command.

@github-fanuser
Copy link
Author

config -set command does not appear to work. Here is a copy of the .bat file.

config -set "mapperfile=C:\Portable\Emulators\DosBox\DOSBox-x\mapper-dosbox-x.map"

:: mount cd images[3] (R drive) / automatically presses 'spacebar' to start game / game executable
imgmount r C:\Portable\Emulators\DOSBox\CD\LBGOLD\LBGOLD-1.iso C:\Portable\Emulators\DOSBox\CD\LBGOLD\LBGOLD-2.iso C:\Portable\Emulators\DOSBox\CD\LBGOLD\LBGOLD-3.iso -t cdrom
ADDKEY.com space
LB.exe

:: unmount cd images[3] (R drive)
imgmount -u r

the map file has certain keyboard keys mapped to a game controller. After the game starts, I hit F11+M to open mapper. None of the keys are mapped to the game controller. If i load the mapper from the conf file when starting doxbox-x,, the keys are mapped to the game controller. There is also no error message when the command is run.

@NebularNerd
Copy link
Contributor

I've not really used mapper files before so I've just tested and it works fine for me (admittedly a very basic test). I deleted the Z and X keys, stupidly choosing the key that prevents me typing exit or pasting the filename of the default mapper. 🤣

You can test the same using this file --> test.zip
Extract it to your DosBox-x directory to save having to deal with drive and path letters

image

mappertest.mp4

@github-fanuser
Copy link
Author

Okay.... the config command works. It is loading the file. The problem appears to be when I load the file using config, it doesn't seem to be loading the saved configuration; it seems to be loading as default. None of my saved mapping is shown. If i load it from conf when dosbox starts, the saved mappings are there.

I also tried mapping keys after loading from config and saving it. It still loads as default the next time I run config. I don't get a message that the map file had be been saved; also the date modified did not change. I checked the file properties and it is not set to read only.

@grapeli
Copy link

grapeli commented Nov 18, 2022

I confirm that loading the mapper configuration file using the config command does not work.
The configuration is loaded correctly when we do it using the menu Main--->Load mapper file... or when starting dosbox-x from the command line.
dosbox-x -set mapperfile=/path/to/mapper/file.map

With the help of the config command, you can specify any non-existent configuration file, and when checked, it will show us that it has been loaded.

config -set mapperfile=/nonexist/directory/blablabla.map
config -get mapperfile
/nonexist/directory/blablabla.map

@github-fanuser
Copy link
Author

github-fanuser commented Nov 18, 2022 via email

@grapeli
Copy link

grapeli commented Nov 19, 2022

This is not an error.
By using the config -set mapperfile= command, you only declare the file to which any configuration changes will be saved made with the mapper editor.
It's not very intuitive if you're using it for the first time. Just like in my case.

@github-fanuser
Copy link
Author

github-fanuser commented Nov 19, 2022 via email

@grapeli
Copy link

grapeli commented Nov 19, 2022

In fact, the mapper editor does not write to the specified file. Surely this must be a mistake.

@github-fanuser
Copy link
Author

github-fanuser commented Nov 19, 2022 via email

@grapeli
Copy link

grapeli commented Nov 19, 2022

You still have the option to reload the mapper configuration file. Some have been given earlier. Although with the help of the config command it doesn't work properly.
Yet another way is a configuration file.

[sdl]
mapperfile=other.map

and
config -bc new.conf

@NebularNerd
Copy link
Contributor

NebularNerd commented Nov 19, 2022

From my test I did the following which worked in that the Z and X keys were disabled.

  • Copy the default .map to test.map
  • Start DosBox-->use `config -set "mapperfile=test.map"->Mapper Editor
  • Delete the Z & X keys from the map->Save map (This updated test.map)
  • Exited Dosbox and relaunched, this loads the default map, Z and X work, load test.map through config they do not work, as poorly shown in video where I could not pasted the default.map name because there was no mapped keys for X.

Loading my test.map and going into the editor, I can re-add the Z key, and save to test.map, Z now works again and file timestamp updated to a few seconds ago.

image

What is weird is that I cannot attach mappings to my XBox360 pad or mouse. Keyboard mappings work as described above but for a simple example no matter what I do I cannot get Button 1 on the pad to type Z on the screen.

##EDIT##
Figured it out, the mapping thing is weird and I was doing it back to front by attached the Key to the Button, instead of Button to Key

@grapeli
Copy link

grapeli commented Nov 19, 2022

Dosbox-x compiled with clang (-fsanitize=address,undefined -fsanitize-recover=all), crashes when executing this command "config -set mapperfile=test.map".
dosbox-x.clang.config.set.mapperfile.log

@github-fanuser
Copy link
Author

github-fanuser commented Nov 19, 2022 via email

@NebularNerd
Copy link
Contributor

NebularNerd commented Nov 19, 2022

I think I've partially figured it out...

When I was testing I was using a recent SDL1 compile for testing another issue, which works as I've described, I only noticed I was on SDL1 when I decided to try another build. Switching to the same compile but SDL2 results in it behaving as @github-fanuser and @grapeli describe. So we were all right. 🤣

In short:

  • SDL1 Builds appear to work as I've described and how we expect them to, loading via config -set "mapperfile=test.map" works and when you edit in Mapper Editor it saves to the correct .map as seen in my images.
  • SDL2 Builds appear to be broken and can only load via the host command line, using the Mapper Editor to make changes only edits the default file not the chosen one. Mappings do not seem to hold/load in this instance.

@github-fanuser
Copy link
Author

github-fanuser commented Nov 19, 2022 via email

@grapeli
Copy link

grapeli commented Nov 19, 2022

In fact, the problem is with the SDL2 version. That's the only one I use.
You can still get around this with the config command in dosbox-x-sdl2.

config -set mapperfile=new.map
config -wcp new.conf
config -bc new.conf

@NebularNerd
Copy link
Contributor

@github-fanuser Can I suggest editing the title of this post to 'SDL2 Issue with Multiple mapper files' and add a bug label, might help to attract more help in solving this issue.

@grapeli looking through the source code there is reference to different MAPPERFILE entries for SDL1 and SDL2 but I can't follow how they are used.

#define MAPPERFILE "mapper-dosbox-x.map"
#define MAPPERFILE_SDL1 "mapper-dosbox-x.sdl1.map"
#define MAPPERFILE_SDL2 "mapper-dosbox-x.sdl2.map"

@github-fanuser github-fanuser changed the title Multiple mapper files SDL2 issue with multiple mapper files Nov 19, 2022
@grapeli
Copy link

grapeli commented Nov 19, 2022

With config -set mapperfile_sdl2=new.map it works fine with dosbox-x-sdl2.

This sdl section option does not show up when running config -get sdl.
Although in the configuration file there is.

@NebularNerd
Copy link
Contributor

With config -set mapperfile_sdl2=new.map it works fine with dosbox-x-sdl2.

This sdl section option does not show up when running config -get sdl. Although in the configuration file there is.

Tested and works for me, seems so weird they would use different .conf entries to perform the same job.

@github-fanuser
Copy link
Author

github-fanuser commented Nov 19, 2022 via email

@NebularNerd
Copy link
Contributor

@github-fanuser it was @grapeli would found there are the two entries so all thanks to them.

I just tested with the file on another drive and it worked for me. Try wrapping the command in quotes to allow for spaces and such: config -set "mapperfile_sdl2=C:\my games\gamename\mapperfileiwanttouse.map"

@github-fanuser
Copy link
Author

github-fanuser commented Nov 19, 2022 via email

@NebularNerd
Copy link
Contributor

The only option is to reload the default, add config -set "mapperfile=mapper-dosbox-x.map" to the end of your .bat file and that will set you back to the default mappings.

I'm going to be doing something similar now for some of the older pre joystick games I have now, then it can just fire up, load the mapper and play the game, then reload the stock config on exit. For ones that do not have an 'Exit To Dos' map a quit DosBox to a two button combo so it's not accidentally pressed (for example both Start and Select on the joypad).

@github-fanuser
Copy link
Author

github-fanuser commented Nov 20, 2022 via email

@NebularNerd
Copy link
Contributor

Glad we were able to figure this out. I am gonna do the same thing you are doing.

Cool, please can you close the issue to help the devs with housekeeping. 🙂

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

No branches or pull requests

5 participants