game settings bug?

Post Reply
sheb
Posts: 4
Joined: Sat Sep 25, 2010 11:50 am

game settings bug?

Post by sheb » Wed Mar 18, 2020 4:09 pm

So i dont think if this is a bug with mojo or the game itself but twice in the last week ive gone to launch a team and the game settings are reset to default. Keyboard setting, windowed mode, and graphics settings are all reset. not sure if this is a mojo thing or game thing but i figured id post here.

Rob
Site Admin
Posts: 1383
Joined: Sat Sep 25, 2010 6:52 am

Re: game settings bug?

Post by Rob » Wed Mar 18, 2020 4:40 pm

Maybe you're seeing a new problem but sounds like you're seeing a very old bug in DAOC. This bug is common and it has been in the client since the game began. The client stores those settings in a file called user.dat. The game tries to save those settings to disk at various times regardless of whether yhou changed them. Occasionally this bug happens and instead of storing your settings in that file, the game stores either a blank file or a corrupted one. Then next time you start DAOC, the client sees an empty or corrupted file and substitutes the default settings. This happens with or without Mojo. Mojo has nothing to do with it.

I think maybe the bug is more likely to happen when you're running multiple DAOC's on the same machine, and they quit at the same time. They may interfere with each others' ability to write the file. Mythic and Broadsword never built proper support into the client for running multiple DAOCs at the same time. This is probably why they limit the number to two, and why, if you're running two DAOC's, they display or used to display a warning that they don't support this and you do it at your own risk.

I built a way of avoiding this bug into Mojo. The bug mainly happens when you exit the client. If you use one of Mojo's ways of terminating the client, the client shuts down abruptly without trying to save user.dat and it can't become corrupted. For example, if you right click the team icon on Mojo's main window, you can click on something that terminates all the team DAOCs simultaneously without giving DAOC's buggy code a chance to run. You can also do this with the red X on the upper right of the client window (MOjo puts that red X there and intercepts the code it runs) or with "Terminate program" when you right-click toon icons in Mojo's main windows or with hotkeys or with Mojo's tray menu or by right-clicking DAOC's task bar icon or with the in-game menus that Mojo adds to the client. If you close DAOC with any of those methods, the bug can't happen because DAOC's buggy code gets bypassed.
Author of Mojo

Simhigi
Posts: 6
Joined: Fri Jan 31, 2020 6:40 pm

Re: game settings bug?

Post by Simhigi » Wed Mar 18, 2020 6:09 pm

This used to drive me crazy. Another option is to setup your settings how you like them, quit out of daoc, and then make your user.dat file read-only in windows. Kudos to @denialoflife for that trick.

sheb
Posts: 4
Joined: Sat Sep 25, 2010 11:50 am

Re: game settings bug?

Post by sheb » Wed Mar 18, 2020 7:58 pm

thanks for quick answer Rob, ill be using mojo to close game from now on.

Rob
Site Admin
Posts: 1383
Joined: Sat Sep 25, 2010 6:52 am

Re: game settings bug?

Post by Rob » Wed Mar 18, 2020 8:59 pm

You're welcome, Sheb. Denialoflife's idea (relayed to us by Simhigi) would work too. Great idea -- hadn't occurred to me. Thanks Simhigi.
Author of Mojo

Rob
Site Admin
Posts: 1383
Joined: Sat Sep 25, 2010 6:52 am

Re: game settings bug?

Post by Rob » Wed Mar 18, 2020 9:06 pm

Simhigi wrote:
Wed Mar 18, 2020 6:09 pm
This used to drive me crazy. Another option is to setup your settings how you like them, quit out of daoc, and then make your user.dat file read-only in windows. Kudos to @denialoflife for that trick.
Great idea. I once tried to fix this problem with Mojo. My plan was that I'd hook the functions that game.dll uses to open, read, and write the file. Then one way or another, I'd make the write/save stuff transactional. Maybe I'd change things so DAOC writes to a temp file, and then Mojo would rename the file if the write operation succeeded. Something like that.

I was assuming that game.dll writes the entire file in a lump, and Mojo would only need to do something when that happens. But when I started to play around with this, I was surprised to see that game.dll writes user.dat in many bits and pieces, and it wasn't obvious to me how I would be able to tell when the entire file had been written.

At that point, I gave up. :) Maybe I gave up too soon but I'm doing this only for fun. :)
Author of Mojo

sheb
Posts: 4
Joined: Sat Sep 25, 2010 11:50 am

Re: game settings bug?

Post by sheb » Thu Mar 26, 2020 3:06 pm

Simhigi wrote:
Wed Mar 18, 2020 6:09 pm
This used to drive me crazy. Another option is to setup your settings how you like them, quit out of daoc, and then make your user.dat file read-only in windows. Kudos to @denialoflife for that trick.
Where do i find the user.dat file. cant seem to find it. I ask because i seem to get this same issue sometimes when just switching characters

Rob
Site Admin
Posts: 1383
Joined: Sat Sep 25, 2010 6:52 am

Re: game settings bug?

Post by Rob » Thu Mar 26, 2020 4:05 pm

sheb wrote:
Thu Mar 26, 2020 3:06 pm
I ask because i seem to get this same issue sometimes when just switching characters
Yep, that's because DAOC saves user.dat every time you quit to the character selection screen even when you didn't change user.dat.

An alternative way to solve this problem is, instead of quitting to the character selection screen, terminate DAOC with Mojo and launch the new toon with Mojo.

It may be faster to do it the second way because you don't have to wait to quit. Also, Mojo's hotkeys may work better if Mojo launches the new toon itself, because then it knows which toon is running.
sheb wrote:
Thu Mar 26, 2020 3:06 pm
Where do i find the user.dat file. cant seem to find it.
If you have a normal DAOC installation (I'll explain the other kinds in a minute) you can use Mojo to open the folder that contains user.dat. Go to Mojo's main menu and click Folders > Show DAOC folders > Show DAOC's roaming app data folder.

But if your DAOC installation is one of Mojo's virtual folders, or if you created a paths.dat folder for DAOC, the copy of user.dat will be somewhere else.

If you solve the problem by making user.dat read only, keep in mind that in the future, if you want to change your Option settings (they include /keyboard) you'll have to remove the read-only protection on user.dat.
Author of Mojo

Post Reply