Core porting questions

https://github.com/MiSTer-devel/Main_MiSTer/wiki

Moderators: Mug UK, Zorro 2, Greenious, spiny, Sorgelig, Moderator Team

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2012
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Core porting questions

Postby Sorgelig » Wed May 23, 2018 6:27 pm

What exactly saved in Legend Of Zelda?
I guess it's not like Action Replay memory dump/restore when you continue play from exact saved state?
This save is some kind of legal save from Nintendo as i guess. So what is saved? Hall Of Fame?

As I see from the code, the saved memory has fixed size and only up to 32KB which can be greatly simplified using BRAM. So i want to optimize this part.

GreyRogue
Atariator
Atariator
Posts: 20
Joined: Thu Mar 22, 2018 3:50 am

Re: Core porting questions

Postby GreyRogue » Wed May 23, 2018 7:23 pm

Sorgelig wrote:What exactly saved in Legend Of Zelda?
I guess it's not like Action Replay memory dump/restore when you continue play from exact saved state?
This save is some kind of legal save from Nintendo as i guess. So what is saved? Hall Of Fame?

As I see from the code, the saved memory has fixed size and only up to 32KB which can be greatly simplified using BRAM. So i want to optimize this part.

Save data is only updated when you create/name a character or when you select save from the menu. To bring up the menu you can either die or press start to bring up the inventory screen and press up+a on controller 2 from the inventory screen. Inventory and number of deaths will be saved. The easiest way to test, though is just create a new character and then verify the name is remembered after power on.

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2012
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Core porting questions

Postby Sorgelig » Wed May 23, 2018 7:43 pm

GreyRogue wrote:Save data is only updated when you create/name a character or when you select save from the menu. To bring up the menu you can either die or press start to bring up the inventory screen and press up+a on controller 2 from the inventory screen. Inventory and number of deaths will be saved. The easiest way to test, though is just create a new character and then verify the name is remembered after power on.

Thanks for tips! I didn't know how to save in the game.

Is it OK to assume that any game will save and restore 32KB? Just for simplification. With fixed size, it will be possible to implement saving slots later.

GreyRogue
Atariator
Atariator
Posts: 20
Joined: Thu Mar 22, 2018 3:50 am

Re: Core porting questions

Postby GreyRogue » Wed May 23, 2018 7:57 pm

Sorgelig wrote:Thanks for tips! I didn't know how to save in the game.

Is it OK to assume that any game will save and restore 32KB? Just for simplification. With fixed size, it will be possible to implement saving slots later.

Some games, including Zelda, only use 8KB, but I don't think any of them care if they are used with 32KB images. I believe there are also some that use even smaller EEPROMs, but I'm not sure. There are also Japanese floppy disk games, but I'm not sure about their save sizes, and I don't think the core supports them currently.

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2012
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Core porting questions

Postby Sorgelig » Wed May 23, 2018 10:12 pm

New version has been released.

User avatar
Newsdee
Atari God
Atari God
Posts: 1142
Joined: Fri Sep 19, 2014 8:40 am

Re: Core porting questions

Postby Newsdee » Wed May 23, 2018 11:10 pm

Woohoo! Been waiting long for this! Thanks a lot!

User avatar
Newsdee
Atari God
Atari God
Posts: 1142
Joined: Fri Sep 19, 2014 8:40 am

Re: Core porting questions

Postby Newsdee » Sat May 26, 2018 4:22 am

How does the save work exactly?

I copied blank.sav into "ZELDA.sav" (for ZELDA.nes), but after I rebooted the save were gone.
I didn't see a menu option to save SRAM; is it done automatically?

NegSol
Captain Atari
Captain Atari
Posts: 215
Joined: Sat Dec 05, 2015 9:22 pm

Re: Core porting questions

Postby NegSol » Sat May 26, 2018 6:07 am

Works for me. Although I did press save state before quitting. Not sure if that is required but it worked. The name was saved. 8)

User avatar
Newsdee
Atari God
Atari God
Posts: 1142
Joined: Fri Sep 19, 2014 8:40 am

Re: Core porting questions

Postby Newsdee » Sat May 26, 2018 8:17 am

Ah, I missed there was a Mister file that was one day older (24th). I see the menu now.

I'd suggest renaming the save/load options to e.g. "Restore saves / Backup saves", otherwise it will be confused with emulators "save states" which backup the entire RAM and CPU state.

In any case, I can play RPGs now! :)
EDIT: Fire Emblem Gaiden seems to work fine!

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2012
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Core porting questions

Postby Sorgelig » Sat May 26, 2018 8:51 am

NegSol wrote:Works for me. Although I did press save state before quitting. Not sure if that is required but it worked. The name was saved. 8)

Yes, you need explicitly save the state before quit. Since, battery backed RAM is just generic RAM which can be written at any time, it's unclear when to save. Game can modify it thousands times per second which may result SD card to wear off if core will write to SD card every time.

User avatar
Newsdee
Atari God
Atari God
Posts: 1142
Joined: Fri Sep 19, 2014 8:40 am

Re: Core porting questions

Postby Newsdee » Sun May 27, 2018 1:58 am

Would it be difficult to make it write on reset or when choosing another file? Many games actually advise to reset before shutting off, so would help remind about it.

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2012
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Core porting questions

Postby Sorgelig » Sun May 27, 2018 5:12 am

In current design it's impossible. Core doesn't know about new game loading - it just gets notification that new game has been loaded with new data already in place. It's just like you press the power off button and device has nothing to do.

Treat the saves as a bonus. Not as a main feature where the FPGA and ARM should run around.

GreyRogue
Atariator
Atariator
Posts: 20
Joined: Thu Mar 22, 2018 3:50 am

Re: Core porting questions

Postby GreyRogue » Fri Jun 01, 2018 11:42 pm

I noticed the MiSTer menu.rbf only supports 50Hz resolution, which doesn't work over VGA on my monitor. I multiplied the four horizontal numbers in menu.sv by 5/6, and it changes the resolution to 60Hz and shows up in my monitor (if slightly off center). I'm not sure if this is useful to anyone or if there is a good way to send desired frame rate to the menu core (I put in a wire for the setting to switch between 50Hz and 60Hz, but nothing is driving it). If anyone cares, it's in my fork of the Menu:
https://github.com/greyrogue/Menu_MiSTer


Return to “MiSTer”

Who is online

Users browsing this forum: No registered users and 4 guests