Retro-Go: Emulator launcher with improved emulators

Post Reply
retroman
Posts: 12
Joined: Fri Dec 13, 2019 4:18 am
languages_spoken: english
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by retroman »

ducalex wrote:
Sat Mar 20, 2021 4:22 am
I've added proportional font support to retro-go. This is just a quick demo with only a few pre-rendered sizes (the rest are stretched) but we can add pre-rendered fonts of each size once the fonts have been selected. I will not work further on the interface right now to avoid interfering with retroman's work.

You can download the alpha build here and please report any glitch!
Hey Ducalex, really cool work, that's exactly what I was about to do. I've been really busy lately, so it is difficult for me to keep it up, but I want to test different fonts, especially some sans serif ones that I've been using in emulationstation and small screens and look really cool, will try to do it the next week if I've got more time.

I've been wondering something that can be really cool and I think it is not really difficult as there are already written libraries for it, AV composite video out. I've seen some github esp32 composite video projects, and they don't look really complicated. I'm looking if can be done through the top gpio header of the odroid, so in this way there will be not any hard modifications. Again, nothing really necessary, but pretty cool to connect the odroid and play on your old crt tv :)

kelbot
Posts: 83
Joined: Thu Aug 29, 2019 12:05 pm
languages_spoken: english
ODROIDs: C2, HC2 x2, Go
Has thanked: 8 times
Been thanked: 3 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by kelbot »

Apologies if this has been answered before but would it be possible to have sub-folder support? It helps keep roms organized for example I have a lot of homebrew roms and like keeping them in a sub-folder.

ducalex
Posts: 306
Joined: Sun May 19, 2019 3:29 am
languages_spoken: english, french
Has thanked: 61 times
Been thanked: 370 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ducalex »

retroman wrote:
Sat Mar 27, 2021 9:21 pm
I've been wondering something that can be really cool and I think it is not really difficult as there are already written libraries for it, AV composite video out. I've seen some github esp32 composite video projects, and they don't look really complicated. I'm looking if can be done through the top gpio header of the odroid, so in this way there will be not any hard modifications. Again, nothing really necessary, but pretty cool to connect the odroid and play on your old crt tv :)
Video generation in the projects you've seen use I2S and the internal DAC which is connected to the speaker on the GO. That's not a big deal, we can generate audio in other ways, but it means the pins we need aren't exposed on the header (the DAC doesn't go through the GPIO matrix, it's hardwired to 25/26).
kelbot wrote:
Mon Mar 29, 2021 12:26 am
Apologies if this has been answered before but would it be possible to have sub-folder support? It helps keep roms organized for example I have a lot of homebrew roms and like keeping them in a sub-folder.
It's on the list but very low priority. I agree it would be nice but surprisingly you're only the second person to request that!

retroman
Posts: 12
Joined: Fri Dec 13, 2019 4:18 am
languages_spoken: english
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by retroman »

ducalex wrote:
Mon Mar 29, 2021 3:25 am
retroman wrote:
Sat Mar 27, 2021 9:21 pm
I've been wondering something that can be really cool and I think it is not really difficult as there are already written libraries for it, AV composite video out. I've seen some github esp32 composite video projects, and they don't look really complicated. I'm looking if can be done through the top gpio header of the odroid, so in this way there will be not any hard modifications. Again, nothing really necessary, but pretty cool to connect the odroid and play on your old crt tv :)
Video generation in the projects you've seen use I2S and the internal DAC which is connected to the speaker on the GO. That's not a big deal, we can generate audio in other ways, but it means the pins we need aren't exposed on the header (the DAC doesn't go through the GPIO matrix, it's hardwired to 25/26).
kelbot wrote:
Mon Mar 29, 2021 12:26 am
Apologies if this has been answered before but would it be possible to have sub-folder support? It helps keep roms organized for example I have a lot of homebrew roms and like keeping them in a sub-folder.
It's on the list but very low priority. I agree it would be nice but surprisingly you're only the second person to request that!
I understand ducalex, I though only the i2s was used, not the internal dac, in this case it would require some soldering and hardware modification, not that friendly. It would be really cool to choose in the menu between lcd and av output as an experimental setting, I will investigate and figure out how to modify cleanly the internal dac hardware wise once I know which connections I need, maybe implement some analog switch to preserve the original dac and be able to use the mod when needed. Maybe this is too much already for this project's scope idk, I though it was a cool idea, will try to do something anyways for the fun and learning (:

PD: I've read that only one of the two DAC outputs (25/26) is needed, so maybe using one DAC with the differential negative wired to ground and using the other DAC output for the AV can be a solution, and this will only require soldering one wire.

ducalex
Posts: 306
Joined: Sun May 19, 2019 3:29 am
languages_spoken: english, french
Has thanked: 61 times
Been thanked: 370 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ducalex »

Yes using one DAC channel for video and the other for audio would give us 8bit audio instead of the current 9bit which is fine, but, according to this, that's not really possible.

I think the best solution would be to use an external I2S DAC, which is already supported in retro-go. But using PWM as in the linked project might work too.

kelbot
Posts: 83
Joined: Thu Aug 29, 2019 12:05 pm
languages_spoken: english
ODROIDs: C2, HC2 x2, Go
Has thanked: 8 times
Been thanked: 3 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by kelbot »

Ok glad sub-folders are on the list :). Currently I switch back and forth between Retro-Go and RetroESP32. RetroESP32 has sub-folder support, a few more emulators and I love it aesthetically. I also love all the improvements you're making with Retro-Go and the new features and improvements to some of the emulators. It's so hard to stick to one :D.

While I don't have the knowledge to do it myself I have to say watching the limits of this little device being pushed is awful fun. I'm already very happy with what it can do and seeing even more stuff come to fruition is great.

ducalex
Posts: 306
Joined: Sun May 19, 2019 3:29 am
languages_spoken: english, french
Has thanked: 61 times
Been thanked: 370 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ducalex »

kelbot wrote:
Mon Mar 29, 2021 10:48 am
RetroESP32 has sub-folder support, a few more emulators and I love it aesthetically.
Agreed, RetroESP32 looks great! (I don't like the fake loading screens though...).

A while ago I was working on a theme creator but I never finished it. Maybe someone can come up with a nice flat theme that I could add to the main build. You can test at: https://htmlpreview.github.io/?https:// ... eator.html . Of course there still wouldn't be animations :(.

retroman
Posts: 12
Joined: Fri Dec 13, 2019 4:18 am
languages_spoken: english
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by retroman »

ducalex wrote:
Tue Mar 30, 2021 4:30 am
kelbot wrote:
Mon Mar 29, 2021 10:48 am
RetroESP32 has sub-folder support, a few more emulators and I love it aesthetically.
Agreed, RetroESP32 looks great! (I don't like the fake loading screens though...).

A while ago I was working on a theme creator but I never finished it. Maybe someone can come up with a nice flat theme that I could add to the main build. You can test at: https://htmlpreview.github.io/?https:// ... eator.html . Of course there still wouldn't be animations :(.
The theme creator is a really cool tool, in the launcher I've used always the black flat background, I think it looks so much cleaner than the gradient ones, but having options is the best.

I always thought that the logo image and header image are basically in esence the same thing imo and the logo image looks a little bit blurry due to the lower pixel density, so I was thinking to try to make only a header, which can make even lighter the launcher or modifying the logo to complement the header better. My idea was to put just the console pixel style drawing isometric style, something like this:

Image

Again, I'm only trying to give me point of view as a designer, which is the field where I have more experience, sorry if I sound picky.

Nemo1984
Posts: 248
Joined: Thu Aug 23, 2018 7:58 pm
languages_spoken: english, french
ODROIDs: Odroid-Go
Has thanked: 92 times
Been thanked: 19 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by Nemo1984 »

I don't disagree that the menu is a little bland. But I think the efforts should be concentrated on functionality first. We don't want to burn out Ducalex.

ducalex
Posts: 306
Joined: Sun May 19, 2019 3:29 am
languages_spoken: english, french
Has thanked: 61 times
Been thanked: 370 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ducalex »

retroman wrote:
Wed Mar 31, 2021 8:33 pm
My idea was to put just the console pixel style drawing isometric style, something like this:

Image

Again, I'm only trying to give me point of view as a designer, which is the field where I have more experience, sorry if I sound picky.
I like the pixel art-style idea. I don't have the skills or the time to do it myself but if you do I'd be happy to integrate in retro-go!

ducalex
Posts: 306
Joined: Sun May 19, 2019 3:29 am
languages_spoken: english, french
Has thanked: 61 times
Been thanked: 370 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ducalex »

Nemo1984 wrote:
Sat Apr 03, 2021 4:53 am
I don't disagree that the menu is a little bland. But I think the efforts should be concentrated on functionality first. We don't want to burn out Ducalex.
Speaking of functionality, I have lost my to do list for retro-go. On top of my head the pending things were:

- Fix the list of games in the top post
- Famicon Disk System
- Netplay
- Game Boy BIOS
- Sub folders
- Atari emulators

Can anyone remind of of things I'm missing? I might start tracking that stuff on github to avoid losing it again...

lordhardware
Posts: 194
Joined: Sat Sep 20, 2014 11:56 pm
languages_spoken: english
ODROIDs: U3
Odroid-W
Has thanked: 42 times
Been thanked: 25 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by lordhardware »

Arduinoboy game launching natively within Go Retro ;)
These users thanked the author lordhardware for the post:
rcarillion (Thu Apr 08, 2021 9:54 am)

ddrsoul
Posts: 23
Joined: Thu Feb 04, 2021 4:47 pm
languages_spoken: english
ODROIDs: Odroid go
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ddrsoul »

ducalex wrote:
Tue Apr 06, 2021 7:48 pm
Nemo1984 wrote:
Sat Apr 03, 2021 4:53 am
I don't disagree that the menu is a little bland. But I think the efforts should be concentrated on functionality first. We don't want to burn out Ducalex.
Speaking of functionality, I have lost my to do list for retro-go. On top of my head the pending things were:

- Fix the list of games in the top post
- Famicon Disk System
- Netplay
- Game Boy BIOS
- Sub folders
- Atari emulators

Can anyone remind of of things I'm missing? I might start tracking that stuff on github to avoid losing it again...
maybe you will also add "sleep mode"?

JLS1
Posts: 13
Joined: Sat Feb 20, 2021 7:00 pm
languages_spoken: english
ODROIDs: Odroid-Go
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by JLS1 »

Chip sound player SID, AY, PT3 etc... willbe great :-) And legendary ZX-Spectrum128+AY emulator :-D

kelbot
Posts: 83
Joined: Thu Aug 29, 2019 12:05 pm
languages_spoken: english
ODROIDs: C2, HC2 x2, Go
Has thanked: 8 times
Been thanked: 3 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by kelbot »

Theme creator or redesigned theme options?

ducalex
Posts: 306
Joined: Sun May 19, 2019 3:29 am
languages_spoken: english, french
Has thanked: 61 times
Been thanked: 370 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ducalex »

kelbot wrote:
Thu Apr 08, 2021 4:30 am
Theme creator or redesigned theme options?
As I said before, I'll gladly accept changes if someone wants to improve the launcher. I can even do the integration if you don't want to mess with git and C, just send me the new images/fonts/colours.

The images to replace are found in launcher/images, the fonts can be any ttf font, and colours can be chosen with the theme creator if desired.
Edit: Naturally any image or font would need to be license-compatible with retro-go, prefer open-source or original resources if you can.

Nemo1984
Posts: 248
Joined: Thu Aug 23, 2018 7:58 pm
languages_spoken: english, french
ODROIDs: Odroid-Go
Has thanked: 92 times
Been thanked: 19 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by Nemo1984 »

I really love the CRC32 cache when idle. I don't have to scroll through every game anymore! Anyone knows where I could buy another odroid go?
These users thanked the author Nemo1984 for the post:
ducalex (Fri Apr 09, 2021 10:14 pm)

kelbot
Posts: 83
Joined: Thu Aug 29, 2019 12:05 pm
languages_spoken: english
ODROIDs: C2, HC2 x2, Go
Has thanked: 8 times
Been thanked: 3 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by kelbot »

ducalex wrote:
Fri Apr 09, 2021 5:17 am
kelbot wrote:
Thu Apr 08, 2021 4:30 am
Theme creator or redesigned theme options?
As I said before, I'll gladly accept changes if someone wants to improve the launcher. I can even do the integration if you don't want to mess with git and C, just send me the new images/fonts/colours.

The images to replace are found in launcher/images, the fonts can be any ttf font, and colours can be chosen with the theme creator if desired.
Edit: Naturally any image or font would need to be license-compatible with retro-go, prefer open-source or original resources if you can.
I will try to find some time to work on this.
These users thanked the author kelbot for the post:
ducalex (Fri Apr 09, 2021 10:14 pm)

ducalex
Posts: 306
Joined: Sun May 19, 2019 3:29 am
languages_spoken: english, french
Has thanked: 61 times
Been thanked: 370 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ducalex »

New release: Retro-Go 1.25 is now available! Download via top post or github.

I was hoping to finish FDS support and fix Battletoads for 1.25 but oh well, it's been almost two months and still not finish so here's a small release...

Changes since 1.24:
- All: Proportional fonts support with correct alignment
- All: Crash log is now saved to the SD Card if possible. Please share it if you encounter a non-obvious crash.
- All: The settings format has changed a little to allow more flexibility (some of your settings will be lost, sorry!)
- GG/COL/SMS: Now have independent settings, you can set different filters and scaling per console!
- Launcher: Idle CRC32 caching, just let your GO sit for a while to never see "CRC32..." again!
- Launcher: Improved responsiveness


Note 1: The idle caching sometimes crashes with "SPI Mutex" message. This is a race condition that I can't easily fix. Just reboot the console, it's harmless.
Note 2: If you encounter weird crashes please delete odroid/retro-go.json. I did a lot of testing but it's possible I missed something.

Thanks everyone for testing!
These users thanked the author ducalex for the post (total 3):
Nemo1984 (Mon Apr 12, 2021 4:07 am) • micro (Mon Apr 12, 2021 5:48 am) • jafox (Wed Apr 14, 2021 1:53 pm)

ddrsoul
Posts: 23
Joined: Thu Feb 04, 2021 4:47 pm
languages_spoken: english
ODROIDs: Odroid go
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ddrsoul »

Hi ducalex,
finally I managed to catch a bug with "save" that leads to crash.
i was on 1.25a2
please check log
Added:
Found not important bug in launcher: i can not rotate full fonts list with left button, it skips some of options (comparing to right button)
Attachments
crash.log
(519 Bytes) Downloaded 10 times

retroman
Posts: 12
Joined: Fri Dec 13, 2019 4:18 am
languages_spoken: english
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by retroman »

ducalex wrote:
Tue Apr 06, 2021 7:32 pm
retroman wrote:
Wed Mar 31, 2021 8:33 pm
My idea was to put just the console pixel style drawing isometric style, something like this:

Image

Again, I'm only trying to give me point of view as a designer, which is the field where I have more experience, sorry if I sound picky.
I like the pixel art-style idea. I don't have the skills or the time to do it myself but if you do I'd be happy to integrate in retro-go!
Don't worry ducalex, you don't have to, I'm working on it and will post a folder and you use it if you want. You are great at improving the launcher functionality, which is what matters the most ;)
These users thanked the author retroman for the post:
Nemo1984 (Wed Apr 14, 2021 10:26 am)

ducalex
Posts: 306
Joined: Sun May 19, 2019 3:29 am
languages_spoken: english, french
Has thanked: 61 times
Been thanked: 370 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ducalex »

ddrsoul wrote:
Mon Apr 12, 2021 6:35 am
Hi ducalex,
finally I managed to catch a bug with "save" that leads to crash.
i was on 1.25a2
please check log
Added:
Found not important bug in launcher: i can not rotate full fonts list with left button, it skips some of options (comparing to right button)
Thanks, the trace allowed me to see where it crashes. However this function has been replaced between 1.25a2 and 1.25 final so it might already be fixed. The crash happens after the save is written but before it is renamed so, if needed, you can recover by going to /odroid/data/gbc and remove .new from the save name.

I'll rework how the save is handled but in the mean time please let me know if it happens again with 1.25.

User avatar
micro
Posts: 16
Joined: Fri Jan 15, 2021 12:17 pm
languages_spoken: English
ODROIDs: ODROID-GO
Has thanked: 10 times
Been thanked: 7 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by micro »

So I've made some more progress with the RTC synchronization, at least for Pokemon Crystal. Sorry for taking so long, unfortunately life got in the way :?

I discovered from the decompilation that the time the player sets at the start of the game is loaded in WRAM, so the time offset can now easily be determined, or even reset to a known value. It should be as easy as reading those values, comparing it to the HW RTC time, and updating the time based on the difference. I'm hoping to have something that works by the end of the week ;)

These addresses could also be useful for implementing cheats in the future, there's a lot of stuff to mess with in here.

Edit 1: debugging in BGB confirms the addresses for the start time. Now I just have to implement it in gnuboy!
Relevant variables and addresses in the decompilation:
01:d4b6 wStartDay
01:d4b7 wStartHour
01:d4b8 wStartMinute
01:d4b9 wStartSecond
We can also automatically toggle daylight savings time based on the launcher setting:
01:d4c2 wDST (bit 7 is all that matters here)

I will also add this for Gold and Silver, as far as I know those addresses are different but there's a decompiled version of those games as well. This should work on most ROM hacks of these games - but I'm less sure about Pokemon Prism, since that hack adds month and day of year to its timing system... that will need more examination.

Edit 2: I have a working solution! I change the above variables to zero with mem_writes, which then allows for the RTC values to be (almost) directly set from the DS3231M. It sets automatically when loading a save state, but not always when loading from SRAM. There's a manual sync option added in the menu to allow for a sync at any time to compensate for this. I may try to add an automatic sync if it isn't too expensive during emulation.

The sync functions also only work with pokemon games, since they're pretty much the only games that use it.

ducalex
Posts: 306
Joined: Sun May 19, 2019 3:29 am
languages_spoken: english, french
Has thanked: 61 times
Been thanked: 370 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ducalex »

micro wrote:
Thu Apr 22, 2021 2:23 am
So I've made some more progress with the RTC synchronization, at least for Pokemon Crystal. Sorry for taking so long, unfortunately life got in the way :?

I discovered from the decompilation that the time the player sets at the start of the game is loaded in WRAM, so the time offset can now easily be determined, or even reset to a known value. It should be as easy as reading those values, comparing it to the HW RTC time, and updating the time based on the difference. I'm hoping to have something that works by the end of the week ;)

These addresses could also be useful for implementing cheats in the future, there's a lot of stuff to mess with in here.

Edit 1: debugging in BGB confirms the addresses for the start time. Now I just have to implement it in gnuboy!
Relevant variables and addresses in the decompilation:
01:d4b6 wStartDay
01:d4b7 wStartHour
01:d4b8 wStartMinute
01:d4b9 wStartSecond
We can also automatically toggle daylight savings time based on the launcher setting:
01:d4c2 wDST (bit 7 is all that matters here)

I will also add this for Gold and Silver, as far as I know those addresses are different but there's a decompiled version of those games as well. This should work on most ROM hacks of these games - but I'm less sure about Pokemon Prism, since that hack adds month and day of year to its timing system... that will need more examination.

Edit 2: I have a working solution! I change the above variables to zero with mem_writes, which then allows for the RTC values to be (almost) directly set from the DS3231M. It sets automatically when loading a save state, but not always when loading from SRAM. There's a manual sync option added in the menu to allow for a sync at any time to compensate for this. I may try to add an automatic sync if it isn't too expensive during emulation.

The sync functions also only work with pokemon games, since they're pretty much the only games that use it.
That all seems a bit complicated (but very interesting!), why not just hook into the RTC writes so that it works on all games? Is it because that way you'd miss the DST?

User avatar
micro
Posts: 16
Joined: Fri Jan 15, 2021 12:17 pm
languages_spoken: English
ODROIDs: ODROID-GO
Has thanked: 10 times
Been thanked: 7 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by micro »

ducalex wrote:
Fri Apr 23, 2021 4:09 am
That all seems a bit complicated (but very interesting!), why not just hook into the RTC writes so that it works on all games? Is it because that way you'd miss the DST?
Writing to gnuboy's rtc would work for any game, but it doesn't actually change anything unless the ROM itself supports RTC functions. The RTC isn't used at all for the vast majority of ROMs - only games that use the MBC3 chip have that feature, and even then the list is relatively short.

It's also necessary to check what game has been loaded because each game/version handles time variables differently. For different Pokemon versions, only the addresses are different. For the other games on that list, the way time is handled could be completely different. It would be harder to figure them out if they aren't decompiled like the Pokemon games are, but I'm willing to give it a shot later :)

For Pokemon games specifically, using mem_write to set all the wStart variables to 0x00 is needed for the sync to be consistent - I was having trouble with that a while ago. Setting these variables all to zero corresponds with a consistent starting time of 12:00:00 AM on Sunday, which then allows for the time to be directly set using the gnuboy rtc struct values. If those variables aren't cleared, the in-game time would be incorrect because the RTC value is offset by this starting time. Clearing it also makes it work for those who already have save games and install the hardware - it makes the time they set at the beginning irrelevant because we can just overwrite it.

I do want to make it as efficient as possible - it uses strncmp to determine the rom.name, so it may be a bit slow. It makes its modifications just before the while loop in gnuboy's app_main and also in the load_state and reset functions. It has a minimal impact on the actual emulation of the game. It basically sets the time initially and lets gnuboy handle the timing afterwards. I'll see if I can make it more efficient - but I think using the rom.name is better than using the CRC to check because ROM hacks will have a different CRC, but sometimes the same rom name. Pokemon Prism has been the only exception I've found so far.

I still have to play around with Pokemon's DST function; it doesn't actually seem to change the time when I overwrite it in BGB. Right now I have the sync function handle DST before the time is injected into the emulator.

Edit: For some reason, my code additions are causing gnuboy's save state screenshots to be corrupted. It's odd because I haven't touched that at all :(
Last edited by micro on Sat Apr 24, 2021 8:17 am, edited 2 times in total.

ddrsoul
Posts: 23
Joined: Thu Feb 04, 2021 4:47 pm
languages_spoken: english
ODROIDs: Odroid go
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ddrsoul »

Hi ducalex,
I got the same bug with "save" in gnuboy
but this time i have retro-go 1.25
please check
Attachments
crash.log
(516 Bytes) Downloaded 9 times

User avatar
micro
Posts: 16
Joined: Fri Jan 15, 2021 12:17 pm
languages_spoken: English
ODROIDs: ODROID-GO
Has thanked: 10 times
Been thanked: 7 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by micro »

I just added an automatic RTC sync option in gnuboy. The performance impact is negligible, no stutters or anything when it updates. I have it syncing roughly every 30 seconds (at 60fps) right now and that seems good enough... the main reason for the auto-sync is to account for any time spent in the emulator's menus without having to manually sync each time.

I want to do some more cleanup, make the time display in the main menu compatible with the different font sizes, try and figure out the gb screenshot corruption issue, and maybe display time in the pause menus if possible, but the core RTC functionality is done :)

ducalex
Posts: 306
Joined: Sun May 19, 2019 3:29 am
languages_spoken: english, french
Has thanked: 61 times
Been thanked: 370 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ducalex »

ddrsoul wrote:
Sat Apr 24, 2021 3:41 am
Hi ducalex,
I got the same bug with "save" in gnuboy
but this time i have retro-go 1.25
please check
Thanks, same bug in miniz. I will make make it fail silently for now but I don't know if I can fix it unless I manage to reproduce it myself.
Can you let me know which game and the approx location in the game causes the crash so I can try to reproduce?

ducalex
Posts: 306
Joined: Sun May 19, 2019 3:29 am
languages_spoken: english, french
Has thanked: 61 times
Been thanked: 370 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ducalex »

micro wrote:
Wed Apr 28, 2021 3:39 pm
I want to do some more cleanup, make the time display in the main menu compatible with the different font sizes, try and figure out the gb screenshot corruption issue, and maybe display time in the pause menus if possible, but the core RTC functionality is done :)
I would prefer if the emulators used the system clock and stdlib time functions instead of the RTC directly. The external RTC should only be used as a reference to load/save time and only the retro-go lib should care about it.

The system clock should be loaded with the ext RTC in rg_system_time_init and the system clock can be saved back to the RTC with rg_system_time_save (which is called automatically by system_monitor_task if the time changes).

Other than that I really like your work, the way you use rg functions where possible and always keep up with my upstream :).
These users thanked the author ducalex for the post:
micro (Thu Apr 29, 2021 5:40 am)

ducalex
Posts: 306
Joined: Sun May 19, 2019 3:29 am
languages_spoken: english, french
Has thanked: 61 times
Been thanked: 370 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ducalex »

I've published the bugfix release 1.25.1 (see top post or github) to address the crash reported by ddrsoul and also some font-related stuff. Very minor release, can be skipped if it doesn't affect you.

ddrsoul
Posts: 23
Joined: Thu Feb 04, 2021 4:47 pm
languages_spoken: english
ODROIDs: Odroid go
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ddrsoul »

ducalex wrote:
Thu Apr 29, 2021 12:57 am
ddrsoul wrote:
Sat Apr 24, 2021 3:41 am
Hi ducalex,
I got the same bug with "save" in gnuboy
but this time i have retro-go 1.25
please check
Thanks, same bug in miniz. I will make make it fail silently for now but I don't know if I can fix it unless I manage to reproduce it myself.
Can you let me know which game and the approx location in the game causes the crash so I can try to reproduce?
Most of the time I play pokemon prism latest build. It is hard to tell how to reproduce the bug, because it happens during different events in game and is very rare.
I think it is ok just to make it "fail silently". With version 1.25 I played around 10+ hours and the bug happened only once. And I do save a lot: during pokemon battles i save everytime i change pokemon.

User avatar
micro
Posts: 16
Joined: Fri Jan 15, 2021 12:17 pm
languages_spoken: English
ODROIDs: ODROID-GO
Has thanked: 10 times
Been thanked: 7 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by micro »

ducalex wrote:
Thu Apr 29, 2021 2:04 am
I would prefer if the emulators used the system clock and stdlib time functions instead of the RTC directly. The external RTC should only be used as a reference to load/save time and only the retro-go lib should care about it.

The system clock should be loaded with the ext RTC in rg_system_time_init and the system clock can be saved back to the RTC with rg_system_time_save (which is called automatically by system_monitor_task if the time changes).

Other than that I really like your work, the way you use rg functions where possible and always keep up with my upstream :).
Thanks, I'll try and make it fit these requirements. I wanted to rely on the external RTC more because the internal RTC is not the most accurate (the internal has around a 5% frequency error, DS3231M is < 0.0002%). Would it be OK if the system time synced periodically with the RTC? Like every 30 minutes or so?

My RTC functions already use <time.h> to utilize time-based structures, such as struct_tm, but from what I understand the system time set using time() is supposed to be seconds since the Unix epoch. I would have to convert that back into a struct_tm in gnuboy to get the exact date back again. Would this be alright?

Also I probably should have mentioned this earlier, but I used a library for the DS3231M functions, for convenience's sake. This is forked from esp-idf lib, and the components used (ds3231, i2cdev) are under the MIT license. It should be alright because MIT is GPL compatible, but if it isn't let me know and I can write my own drivers :)

ducalex
Posts: 306
Joined: Sun May 19, 2019 3:29 am
languages_spoken: english, french
Has thanked: 61 times
Been thanked: 370 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ducalex »

The internal RTC is inaccurate when it's clocked by the internal resonator (in my experience it drifts up to 5s per hour) but when it's clocked by the main crystal (as in our case) it's quite accurate. That being said I don't mind periodic syncs if you think it's better! Alternatively we can also call rg_system_time_init/rg_system_time_save when performing key actions like saving/loading state. If we do that maybe a better name than rg_system_time_init would be needed, like rg_system_time_load? or rg_rtc_load/rg_rtc_save? But I digress...

For the epoch stuff I think on the emulator side you'd replace ds3231_get_time with something like:

Code: Select all

time_t now = time(NULL);
struct tm *timeinfo = localtime(&now);
and ds3231_set_time with something like:

Code: Select all

struct timeval tv = {mktime(timeinfo), 0};
settimeofday(&tv, 0);
And on the retro-go side to set system clock to RTC time (probably in rg_system_time_init):

Code: Select all

struct tm timeinfo;
ds3231_get_time(dev, &timeinfo);
struct timeval tv = {mktime(timeinfo), 0};
settimeofday(&tv, 0);
and to set RTC to system time (probably in rg_system_time_save):

Code: Select all

time_t now = time(NULL);
struct tm *timeinfo = localtime(&now);
ds3231_set_time(dev, timeinfo);
BTW you can just finish what you had in mind and I'll do the system clock integration!


License looks fine, thanks for taking the time to check! GPL code can't go into the retro-go lib directly but MIT/BSD/etc is all fine.


Edit: PS: I typed those snippets from the top of my head, it probably won't work as is... :(
Edit2: PPS: The reason I insist on using the system clock is that I want the emulators to remain portable outside of retro-go. At this point there is (almost) no retro-go specific code in the emulators themselves, only in the port's main.c. Another bonus is that it will make further apps who depend on time "just work". Having system time also gives us the ability to have correct mtime when saving to the SD Card or logging. It also gives us the ability to have multiple time sources (i2c RTC, NTP, Manual) through a single standard API.

I think having the correct creation time on save states would be pretty neat once I enable multiple save states support.
These users thanked the author ducalex for the post (total 2):
micro (Thu Apr 29, 2021 7:43 am) • Nemo1984 (Sat May 01, 2021 1:53 am)

User avatar
micro
Posts: 16
Joined: Fri Jan 15, 2021 12:17 pm
languages_spoken: English
ODROIDs: ODROID-GO
Has thanked: 10 times
Been thanked: 7 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by micro »

Thanks for the tips! I went ahead and did the integration, it pretty much works as you described with some minor time offsets. I now see why you wanted to use system time: it's a lot easier on the emulator side, and much cleaner since the RTC doesn't need to be communicated with directly :)

Now all my time functions use the system time after it's synced with external RTC. Changing the time in the main menu updates the system time, and the system automatically updates the external RTC afterwards :)

I just got the full date sync working in Pokemon Prism and the last thing I really want to do is get the time display in the main menu to resize dynamically with the chosen font. I have results, but some fonts just seem too... big for it to be practical - the text overlaps the graphics if it's too tall, and oftentimes it's too wide for the screen. Maybe this should be done later when themes are worked out more? Or we could have the time use one specific font. It may also be better to have a whole bar on top just for the time (like we see on our phones), but only when the RTC is installed. Right now it kinda just "fits" inside the graphics, at least with the basic 8 font.
Having the time show up in the emulator pause menus would be cool, but I think it would require a lot of changes since the menus are static.

I hope if there's a GO V2, Hardkernel adds an external RTC to the PCB so everyone can take advantage of it, but I guess we have to wait for the S3 first :mrgreen: As things are, it is kinda an expensive add-on just for this benefit.
These users thanked the author micro for the post:
ducalex (Mon May 03, 2021 5:57 am)

ducalex
Posts: 306
Joined: Sun May 19, 2019 3:29 am
languages_spoken: english, french
Has thanked: 61 times
Been thanked: 370 times
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by ducalex »

micro wrote:
Sat May 01, 2021 3:29 pm
I really want to do is get the time display in the main menu to resize dynamically with the chosen font. I have results, but some fonts just seem too... big for it to be practical - the text overlaps the graphics if it's too tall, and oftentimes it's too wide for the screen. Maybe this should be done later when themes are worked out more? Or we could have the time use one specific font. It may also be better to have a whole bar on top just for the time (like we see on our phones), but only when the RTC is installed. Right now it kinda just "fits" inside the graphics, at least with the basic 8 font.
Having the time show up in the emulator pause menus would be cool, but I think it would require a lot of changes since the menus are static.

I hope if there's a GO V2, Hardkernel adds an external RTC to the PCB so everyone can take advantage of it, but I guess we have to wait for the S3 first :mrgreen: As things are, it is kinda an expensive add-on just for this benefit.
Displaying 15:00 in small on the left of the battery should work fine in both the launcher and emulators (we can live with some header overlap). However if you want 03:00:00 PM then there's no way it will fit indeed.

Maybe we could put it under the battery where "No cover" currently displays? Same for emulators we could put it just under the battery but I think some menus would cover it.

I also agree it would be okay to always use the smallest font for time but I don't think the API can currently do that? (I can't check right now sorry) We'd probably have to int f = rg_gui_get_font_info().type; rg_gui_set_font_type(0);rg_gui_draw_text(...);rg_gui_set_font_type(f); which works but isn't super nice :(.

It's tough to deal with small screen, every pixel is a compromise :p.
These users thanked the author ducalex for the post:
micro (Mon May 03, 2021 7:23 am)

talkman
Posts: 4
Joined: Tue Jul 10, 2018 12:15 pm
languages_spoken: english
ODROIDs: ODROID GO
Has thanked: 0
Been thanked: 0
Contact:

Re: Retro-Go: Emulator launcher with improved emulators

Post by talkman »

Hi ducalex, thank you for your ongoing support.

BTW how can I use the in-game cheat?
I pressed the A button in 'Cheats' in 'Debugging', but it just closes the screen.

Post Reply

Return to “Game Emulators”

Who is online

Users browsing this forum: No registered users and 2 guests