Dreamcast - Reicast - Time and Date
-
There's a known issue with Reicast (linux/retropie) that it will no longer permanently set the time and date for the bios, meaning that every time you start up Reicast you need to set the time and date. For a short while, there was a workaround but that no longer works for me: https://retropie.org.uk/forum/topic/364/every-time-i-play-dreamcast-displays-the-setting-screen-time-date/51
On my Pi, I've tried to compile a couple of forks of Reicast which say that they include a fix for this problem, but so far without success. I'm just wondering please if anyone has had any success compiling one of these forks or another fork of Reicast to fix this problem, or whether there might be another workaround or solution other people are using.
https://github.com/7oxicshadow/reicast-emulator
https://github.com/7oxicshadow/reicast-emulator/commits/master
https://github.com/gizmo98/reicast-emulator/tree/3eff2a23f63e031e0ce53ef256443fa847889f84
https://github.com/gizmo98/reicast-emulator/commit/3eff2a23f63e031e0ce53ef256443fa847889f84 -
I'm curious about this as well. I could never get any of the workarounds to work either.
-
@backstander Funnily enough, I noticed on another thread a @gizmo98 . Not sure if this is the same gizmo98 who forked reicast. If so, would be nice to know his/her thoughts?
-
I have no solution. This is a long standing issue.
-
I have my own solution for this reicast issue. I don't have a RPI and I don't use Retropie (I have an Odroid XU4 with OGST), but my solution should works on the Pi too.
You will need to edit the emu.cfg file in the reicast folder (I don't know the location in Retropie)
The Dreamcast.RTC field has to be edited every time you launch a game. It actually needs your local time minus or plus the offset between your local time and Greenwich time (GMT), AND you need to add 20 years (the result has to be converted in seconds).So here are the steps to get your time/date always updated when you launch a Dreamcast game:
- Backup these 2 files ....reicast/data/dc_flash.bin and /....reicast/emu.cfg, just in case.
- If reicast always asks you to set the time/date, then you need to fix that first, otherwise you can go to the next step. Here is how to fix this first problem:
- Install dreamcast emulator "NullDC" on a PC
- Start dreamcast without a game and you are in the bios
- Make your settings (date,time,language) and exit the bios
- NullDC just has created a new file in the /data directory : dc_nvmem.bin
- Rename dc_nvmem.bin to dc_flash.bin and copy the file into your RPI "....reicast/data", overwrite existing file
- Start reicast with or without a game to check if you don't have the Time/Date screen again
- You need to run these lines before launching a game. So the lines have to be added to your launcher script in Retropie. Here they are (You need to edit the path to reicast folder in Retropie):
### Update the time/date in emu.cfg time_offset=$(date +'%:::z') # Get how many hours of difference between local time and Greenwich time (GTM) newtime=$(date -d "$(date -d "+20 years $time_offset hours" +%D) $(date -d "+20 years $time_offset hours" +%T)" +"%s") # The result is in seconds (ex: 2125613317) with an offset of +20 years sudo perl -i -p -e "s|Dreamcast.RTC = .*|Dreamcast.RTC = "$newtime"|" /path/to/reicast/emu.cfg # Replace Dreamcast.RTC value in emu.cfg
It should work with any timezones.
I have an RTC battery so the time is always up to date, but if you don't have one or if you're not connected to your network, it should at least remove the Time/Date screen when you launch a rom (I guess).
-
@tipoto Thank you. (Just added you both FYI @backstander @gizmo98 )
I'll have a go later on with respect to this, but I just wanted to clarify something.
With Retropie, we do have an
emu.cfg
. It appears in the/opt/retropie/configs/dreamcast/
folder.Are you saying that the code below is added to the
emu.cfg
as so, so that it looks like this?:[code] ###Update the time/date in emu.cfg time_offset=$(date +'%:::z') # Get how many hours of difference between local time and Greenwich time (GTM) newtime=$(date -d "$(date -d "+20 years $time_offset hours" +%D) $(date -d "+20 years $time_offset hours" +%T)" +"%s") #The result is in seconds (ex: 2125613317) with an offset of +20 years sudo perl -i -p -e "s|Dreamcast.RTC = .*|Dreamcast.RTC = "$newtime"|" /path/to/reicast/emu.cfg # Replace Dreamcast.RTC value in emu.cfg [/code] [audio] disable = 0 [config] Debug.SerialConsoleEnabled = 0 Dreamcast.Broadcast = 4 Dreamcast.Cable = 3 Dreamcast.RTC = 1543276800 Dreamcast.Region = 3 Dynarec.Enabled = 1 Dynarec.idleskip = 1 Dynarec.unstable-opt = 0 aica.LimitFPS = 1 aica.NoBatch = 0 aica.NoSound = 0 bios.UseReios = 0 pvr.MaxThreads = 3 pvr.Subdivide = 0 pvr.SynchronousRendering = 0 pvr.rend = 0 rend.UseMipmaps = 1 rend.WideScreen = 1 ta.skip = 0 [dispmanx] height = 1080 maintain_aspect = no width = 1920 [input] evdev_device_id_1 = 9 evdev_device_id_2 = 7 evdev_device_id_3 = -1 evdev_device_id_4 = -1 evdev_mapping_1 = /opt/retropie/configs/dreamcast/mappings/controller_DragonRiseInc.GenericUSBJoystick.cfg evdev_mapping_2 = /opt/retropie/configs/dreamcast/mappings/controller_DragonRiseInc.GenericUSBJoystick_Player2.cfg joystick_device_id = -1 [omx] audio_hdmi = yes audio_latency = 100 [players] nb = 2 [reios] ElfFile = [testing] ta.HashCheckFile = ta.HashLogFile = [validate] OpenGlChecks = 0
Or that the code goes into a launch file (which would probably be
runcommand-onstart.sh
for Retropie) ? -
@tipoto Hi. So I have experimented a little bit with your code but can't get it to work. For anyone else interested, this is what I did. I have previously used NullDC to create a new
dc_flash.bin
so just retained that bios.I added the following to
runcommand-onstart.sh
:### DREAMCAST - REICAST - Time and date correction ### Update the time/date in emu.cfg ### Get how many hours of difference between local time and Greenwich time (GTM) ### Replace Dreamcast.RTC value in emu.cfg ### The result is in seconds (ex: 2125613317) with an offset of +20 years Time="time_offset=$(date +'%:::z') newtime=$(date -d "$(date -d "+20 years $time_offset hours" +%D) $(date -d "+20 years $time_offset hours" +%T)" +"%s") sudo perl -i -p -e "s|Dreamcast.RTC = .*|Dreamcast.RTC = "$newtime"|" /opt/retropie/configs/dreamcast/emu.cfg"
and:
reicast-audio-oss) joycommand="$Time &" eval $joycommand ;;
There was no change. Perhaps someone else could experiment with tipoto's code?
-
To answer your first question, emu.cfg has to be edited by the script, not manually, but I think you figured it out when you did your test.
I looked at the retropie wiki and it seems that you modified or created the right script "runcommand-onstart.sh", which has to be placed here: /opt/retropie/configs/all/.
However, you modified my code and it can't work this way.If you need a function and a case statement, then try this instead:
dreamcast_time_fn () { ### DREAMCAST - REICAST - Time and date correction ### Update the time/date in emu.cfg ### 1) Get how many hours of difference between local time and Greenwich time (GTM) ### 2) Calculate the current time in seconds (ex: 2125613317) with an offset of +20 years ### 3) Replace Dreamcast.RTC value in emu.cfg with the result time_offset=$(date +'%:::z') newtime=$(date -d "$(date -d "+20 years $time_offset hours" +%D) $(date -d "+20 years $time_offset hours" +%T)" +"%s") sudo perl -i -p -e "s|Dreamcast.RTC = .*|Dreamcast.RTC = "$newtime"|" /opt/retropie/emulators/reicast/emu.cfg }
and, inside a case statement:
reicast-audio-oss) dreamcast_time_fn ;;
"reicast-audio-oss" looks weird to me, but I don't have Retropie so I don't know what is the variable when you launch reicast. Make sure it is the right value.
Also I assume that the case statement is the right way to go, but again, make sure it is correct.EDIT:
2 more things:- Just in case, make sure to give the permissions on the bios file "dc_flash.bin"
- You need to make sure that reicast starts without displaying the time/date screen, my script won't fix that by itself, it will only make sure that the date is updated with the current time when you launch a game. When reicast starts, it checks the emu.cfg, then it grabs the "Dreamcast.RTC" value, then it updates the bios with it.
-
@tipoto
Where are you putting the "case statement":reicast-audio-oss) dreamcast_time_fn ;;
Does that go in
/opt/retropie/configs/all/runcommand-onstart.sh
as well?Also, shouldn't there be a test before running
dreamcast_time_fn ()
to ensure that reicast is the emulator being ran so this doesn't have to execute every time the Runcommand is invoked? -
Like I said, I don't have Retropie, so I don't know the structure and how it works exactly.
About this:reicast-audio-oss) dreamcast_time_fn ;;
This code is part of a case statement and it comes from
spud11
, I just edited what he wrote in his post to make it look good. My original post didn't content this part. You have to make sure by yourself that this case statement is correct and logical. If so, it has to be in/opt/retropie/configs/all/runcommand-onstart.sh
, after the functiondreamcast_time_fn
(not before)I don't know how Retropie gives you the information about the starting emulator, hopefully someone in the forum could help for this detail. When
spud11
added the case statement, I thought it was part of the Retropie structure and it was the answer to that. But double check with someone whom knows Retropie.You will need something that looks like this (but adapted to Retropie):
launched_emulator="$1" case "$lauched_emulator" in reicast) dreamcast_time_fn ;; mupen64plus) # your code ;; *) # your code ;; esac
It would be great to have someone in the forum to tell you exactly where to add my function and how to tell Retropie to launch it only with reicast.
-
@tipoto Hi. Yes, I do recognise the case statement you are using. Might be easier, to give things a bit more structure, for me to extract from my
runcommand-onstart.sh
the appropriate parts I have (adapted to your new code - thank you!). I've also created the newdc_flash.bin
as per instructions just to make sure my old one wasn't the problem.My
runcommand-onstart.sh
is very long, so I'll just take out the parts that are relevant and then we can look at it again and, hopefully, as you pointed out, one of the moderators might take an interest:### Code begins ### Game/ROM full path rom="${3##*/}" dreamcast_time_fn () { ### DREAMCAST - REICAST - Time and date correction ### Update the time/date in emu.cfg ### 1) Get how many hours of difference between local time and Greenwich time (GTM) ### 2) Calculate the current time in seconds (ex: 2125613317) with an offset of +20 years ### 3) Replace Dreamcast.RTC value in emu.cfg with the result time_offset=$(date +'%:::z') newtime=$(date -d "$(date -d "+20 years $time_offset hours" +%D) $(date -d "+20 years $time_offset hours" +%T)" +"%s") sudo perl -i -p -e "s|Dreamcast.RTC = .*|Dreamcast.RTC = "$newtime"|" /opt/retropie/configs/dreamcast/emu.cfg } case $2 in reicast-audio-oss) $dreamcast_time_fn ;; esac
I've added the
$
sign to the command above as I believe it will need it.
For the sake of completeness, myruncommand.info
file, followed by myruncommand.log
, are as follows:dreamcast reicast-audio-oss /home/pi/RetroPie/roms/dreamcast/NBA Showtime.cdi /opt/retropie/emulators/reicast/bin/reicast.sh oss "/home/pi/RetroPie/roms/dreamcast/NBA Showtime.cdi"
As you will see from the above, case $2 (which is what I use) is
reicast-audio-oss
. And the log:Parameters: Executing: /opt/retropie/emulators/reicast/bin/reicast.sh oss "/home/pi/RetroPie/roms/dreamcast/NBA Showtime.cdi"
There are no errors from the log, but there is also no change to the outcome - I still need to do the time/date thing.
-
Nope, don't add
$
to call the function, I'm surprised you didn't get an error with that.However even if my function is eventually called, it seems that it won't fix the fact that you will be asked for the date/time, you need to fix this issue first, then my script will make sure that it won't happen again and you will always have the current time on with your saves on the VMU.
It's weird that you still have this screen since you created a fresh bios as I asked to do. What type of bios did you create (Region free, NTSC, PAL... ?), if it was a region free, try a specific one (PAL or NTSC), it won't restrain you to play any game, it will just chose a frame rate by default (50 or 60 fps). Also, try to change the permissions on the bios, just in case reicast doesn't manage to edit the file.
To do so, you can do:sudo chmod 777 /path/to/the/bios/dc_flash.bin
EDIT:
By the way, the function is not really necessary, you can put the content of the function directly into the case statement if you want, it's up to you. -
@tipoto Okay, I'm having trouble changing the permissions from 0755 to 0777 even with sudo. I'll need to check which bios I created too. Unfortunately, I've got to go out now. Thanks for your help.
-
Oh... I forgot to mention something very important! When you create the new
dc_flash.bin
with NullDC (by renamingdc_nvmem.bin
), you have to launch a game and set the date/time! Otherwise the manipulation is completely useless.
After that it should work in your RPI without asking for the time/date anymore.Another thing that I just noticed, even with my script, if you don't play a game for too long (maybe one month or so), it will ask for the time/date again since the registered time in
dc_flash.bin
and the time inemu.cfg
will be too different.
Once the gap is too big, it seems that reicast doesn't refreshdc_flash.bin
properly anymore.
I just had to recreate adc_flash.bin
right now for this reason. The problem has been fixed immediately with the new file, so it should work for you too. ;) -
@tipoto Hi. I've finally got back to this. Thanks for the extra info too.
I haven't yet checked which version of the BIOS I'm using (ie Region free etc), because I haven't yet got past the issue with the write permissions using my current
dc_flash.bin
. If it's necessary to write to this file, then that is currently a stumbling block.Using both WinSCP and Putty, I've tried to change the permissions both of the BIOS folder and of the individual file
dc_flash.bin
, both without success. The permissions remain 755 rather than 777, meaning no write access for Group and Others.Tried
sudo chmod 777 dc_flash.bin
from within the folder andsudo chmod -R 0777 /home/pi/RetroPie/BIOS
without success.I'd like to try to sort this out before experimenting much further. Hopefully, someone will chime in on why the BIOS files can't be made 0777.
-
@tipoto Okay. Just went back to NullDC - it's a US NTSC Bios. I set the date to 12/28/1998 and it now loads automatically in NullDC without requesting further time/date input, but having tried it again in Retropie, it requires further time/date input.
As you suggested, I removed the case statement so it now appears as follows in
runcommand-onstart.sh
:reicast-audio-oss) time_offset=$(date +'%:::z') newtime=$(date -d "$(date -d "+20 years $time_offset hours" +%D) $(date -d "+20 years $time_offset hours" +%T)" +"%s") sudo perl -i -p -e "s|Dreamcast.RTC = .*|Dreamcast.RTC = "$newtime"|" /opt/retropie/configs/dreamcast/emu.cfg ;;
There are no errors in the log. Unless it is the 777 write permissions, I'm not sure what the problem is.
-
I think you misunderstand a few things, so I need to clarify:
- You need to set the time/date in NullDC, which means that you have set 06/24/2017 and the current time. Don't leave it in 1998.
- In the new code that you kept in your
runcommand-onstart.sh
, you actually kept the case statement and you removed the function, which is fine, but I just wanted to clarify this since you were saying that you removed the case statement and it's not the case.
For the permissions change, first of all I want to mention that it's maybe not necessary to do it, I was just suggesting to do it since we didn't get any result with the other things that we tried, maybe it will work without modifying the permissions. With that said, if you are still stuck, it is worth trying this option. If you don't manage to change the permissions, maybe it's because you are logged as
root
and you try to use sudo, if it's the case, don't use sudo.
And if you are not logged asroot
, you can try to do it, but it should normally work when you are logged aspi
with using sudo. -
@tipoto You, sir, are brilliant!
The workaround does work. I went back to NullDC and created a new bios, setting the date to the current date of 06/25/2017, then copied that bios into my Retropie bios folder. (The bios is US NTSC, for anyone else who wants to give this a go).
The case statement (rather than the function, as you pointed out) in
runcommand-onstart.sh
is:reicast-audio-oss) time_offset=$(date +'%:::z') newtime=$(date -d "$(date -d "+20 years $time_offset hours" +%D) $(date -d "+20 years $time_offset hours" +%T)" +"%s") sudo perl -i -p -e "s|Dreamcast.RTC = .*|Dreamcast.RTC = "$newtime"|" /opt/retropie/configs/dreamcast/emu.cfg ;;
The permissions in respect of the bios remain 755 which is fine as it seems to work anyway.
I note also your point that the bios might have to be recreated every now and again for it to continue working, but this workaround is very good (in my view) and hopefully others using Retropie will be able to replicate it easily enough.
I hope a moderator picks up your instructions, tipoto, and adds it to the wiki.
My next step will be to go back to the "function" method, so that I can set it up to work concurrently with xboxdrv in a case statement applying to Reicast.
Thank you!
Edit: One thing I should add is that I didn't need to set the date/time "in game" once. It just seemed to work straightaway and I've now tested with half a dozen games and even reset the Pi in between games and it continues to work.
-
I'm glad that the new bios worked this time! :)
But I'm also curious to know if the script works too! ;)
The fact that you can now skip the time/date screen is only due to the new bios (you don't need any script for that), but my little script allows the system to also update the time every time you launch a game. That way you always have a logical time when you save a game on the VMU, it should also prevent reicast to display the time screen again since the date and time will be refreshed regularly (it's why you have to launch a game on a regular basis otherwise the screen will eventually come back again).Could you just open reicast without any game, so you can have access to the system manager? Here you should read the date and time, if it's up to date, it means my script has been launched, otherwise it means that the case statement doesn't do anything.
If the time is not refreshed, could you send me yourruncommand-onstart.sh
file, so I can take a look at it?Thanks!
-
I've been trying to figure this out as well. Thanks for the info on the bios!
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.