Custom Firmware for Atgames Legends Flashback with support for Arcade games

rrifonas

Well-Known Member
OP
Member
Joined
Jan 28, 2009
Messages
258
Trophies
1
XP
1,265
Country
United States
As I commented before MAME 2000 has a weird way to look for the content folder... if the front end does not return a directory it tries to create a folder called (null) in the same path as the emulator. In our case this path is read only and it fails.

Other MAME versions and FBA have a different logic, if the front end does not return the path, they create the files under a folder in the content dir.

As a workaround I will create the nvram externally and add to the emulator partition. That will fix these games expecting to read data from nvram on boot.

If you know how to compile the core for arm you are more than welcome to fix the code... the file is called libretro.c :D
 

Zaphod77

Well-Known Member
Member
Joined
Aug 25, 2015
Messages
665
Trophies
0
Age
49
XP
615
Country
United States
I see the issue.

the issue is that the system directory isn't being set by the frontend, so the system directorty is NULL, so the save directory is also NULL, which terminates the string. you will NEVER be able to make stuff load, even by copying it onto the emulator partition, because the starting null from before stuff is tacked onto it terminates the string.

The save directory is set before the game is loaded, and the code doesn't know the ROM path until the game is loaded. BUT the nvram and hi and all those directories are set AFTER the load.

So we have to patch starting at line 713 to instead of work off of core_save_directory, which is null, and cant' have stuff added onto it, to instead work from IMAMEBASEPATH, which is set above there to be the load path for the rom.

with this you can make the games save highscores too.

since IMAMEBASEPATH is (char *) and the nvdir and whatnot are ALSO (char*) it should be simple to do the patch. i do not have an arm cross compiler though.

anyone here have a cross compiler to fix this?
 

rrifonas

Well-Known Member
OP
Member
Joined
Jan 28, 2009
Messages
258
Trophies
1
XP
1,265
Country
United States
It creates a folder (null) in the same path as emulator, and a mame2000 folder inside with the contents. I already tested this in a Tinkerboard (much better HW, but it's a Rockchip processor) setting the partition as read-write.
I've also tested the solution in the Legends Flashback, and it works fine. I just need to test a couple of games now (tested only Joust) and I will release the update today.

One fix for the core is to hard-code this "NULL" as /media/usbhd-mmcblk0p1/GAME, it fix the issue and the 'mame2000' folder structure will be created. A more elegant solution is to copy the code from MAME 2003 where if the 'front end' does not pass the variables it assumes that SYSTEM DIRECTORY is the the content directory.
 
  • Like
Reactions: MicroNut99

Zaphod77

Well-Known Member
Member
Joined
Aug 25, 2015
Messages
665
Trophies
0
Age
49
XP
615
Country
United States
well just because it has an nvram prewritten doesn't mean you can change it.

The code there DOES load content directory, which if i'm right is the DATA directory.

So

what happens if you replace the existing genesis gx plus core with the snes classic one? it may actually give you the ability to load nvram?
or the one form the genesis flashback 2018, which DOES load them?
 
Last edited by Zaphod77,

rrifonas

Well-Known Member
OP
Member
Joined
Jan 28, 2009
Messages
258
Trophies
1
XP
1,265
Country
United States
I've added the new update to the first post. The update will allow the Williams games to load.

The limitation with the Genesis Core looks different. The core is shared between Genesis Flashback and the Legends Flashback, they have exactly the same hash, this confirms the issue is the emulator - and it can't be replaced.
Replacing the core with the one from SNES Classic creates another issue with 6-button controller.
 

Zaphod77

Well-Known Member
Member
Joined
Aug 25, 2015
Messages
665
Trophies
0
Age
49
XP
615
Country
United States
but when it's in th genesis flashback it DOES load nvram, and when it's in the legends, it doesn't!

thsi means it's some differenc ein what the frontend sets... are you sure the cores are binary identical?
 

Zaphod77

Well-Known Member
Member
Joined
Aug 25, 2015
Messages
665
Trophies
0
Age
49
XP
615
Country
United States
Now i'm trying to trace the plus gx code, and figure out how the hell they managed to break it on the legends flashback but not the genesis one.

they also clearly ave some hackery to use thier own 6 button controllers that don't have mode buttons on them. that's probably why the snes classic core doesn't work.

btw there are in fact games that detect the mode button on the 6 button controller. atgames is probably unaware of this. their clone 6 button controller has no mode button, and most likely is stuck in 6 button mode.

oddly enough, this mode button feature is undocumented, but the games do use it.

what does replacing the core do to the 6 button controller? and why does replacing nes cores work but replacing their core doesn't.

the console cores that run on the device seem to use the retroarch api to load and save sram and savestates, as well as rewind.

I'm having real trouble seeing this as anything but deliberate crippling on their part.
 
Last edited by Zaphod77,

rrifonas

Well-Known Member
OP
Member
Joined
Jan 28, 2009
Messages
258
Trophies
1
XP
1,265
Country
United States
The core is the same. The emulator is set for 6-button controller, and I think the core can make the problematic games work. Golden Axe 2 works fine, this is the same behavior from the RetroArch cores in Windows. They don't rely on the mode button so Atgames mapped it as the "mode" button.
The Genesis Plus GX implementation from SNES Classic give some issues with 6-button controllers games (some games work as 3-buttons only).
The problem with battery save in Genesis core is in their emulator, unfortunately.
I really don't understand why you are complaining so much about the battery save for Genesis... Save State work just fine for these games and it's better than the original save.
And I still think this device is doing 'too much' for a $45 (or less) device.
 
Last edited by rrifonas,

Zaphod77

Well-Known Member
Member
Joined
Aug 25, 2015
Messages
665
Trophies
0
Age
49
XP
615
Country
United States
the main reason i'm complaining is that save states do NOT include the sram.

so if you save, quit to menu, save state, then load it, you will have an empty save menu and lose everything!

A real world case for this. you save at the start of a boss battle in an rpg. You try to beat it. you get hosed by bad luck. you load state and try again. you get hosed again. you shut it off and go to bed.

You try again tomorrow. you load your state and you are back there. But you just cannot win. You game over, and get sentto the title screen. you can just continue, right? Nope. save is gone!

If the sram was saved in the save state (as most emulators do), it would be there waiting for you, and you would be fine. the game helpfully asks you what save state to load if there is one.

but rpgs generally won't let you continue after a wipe without returning to the title screen. which is not a safe pace to save state when the sram is not included in the save state, and sram files are not loaded when you return to the emulator.

If the game actually loads the save data before the menu is printed, like say zelda most likely does, than its' not an isue. but say phantasy star 2 goes back to the titel screen afte a wipe. and if your save is before you bring up the load menu...

The leaving sram out of the save state is actually a brilliant idea, because many people have lost sram by loading a state. It was actually a masterstroke... on the genesis flashback. but this fix is pointless if the sram files are not loaded. In that case it would be better to include the sram in the save state.

normally you should either save state or use ingame saves. using save states instead of ingame works fine for action games. but not for rpgs. normally even if you save state into a corner in an rpg, you can return to your last ingame save after you die. but with this console, you can't do that unless it was made during this session with it.

This is a unique brand of crippling that no other device does.
 
Last edited by Zaphod77,

Zaphod77

Well-Known Member
Member
Joined
Aug 25, 2015
Messages
665
Trophies
0
Age
49
XP
615
Country
United States
On the bright side, there is a way to run bubble bobble arcade on this. :)

if you grab the boblbobl rexux bootleg, you can take the bb3 bb4 abd bb5 roms, and replace the normal boblbobl roms with them. this gets you a working bubble bobble with correct enemy behavior. :)

if you got it right, the title screen will say Bubble Bobble BOOTLEG REDUX, the demo will say bubbles instead of bobbles. and the game plays great.
 

HopTronix

Member
Newcomer
Joined
Feb 4, 2017
Messages
13
Trophies
0
Age
38
Website
newhollandbrew.com
XP
86
Country
United States
@rrfonas excellent work! I installed the previous firmware version last week and was exited only to get to Mame Defender and find it hangs. Now it’s nearly perfect with the Williams firmware fix. Thanks for the hard work in the ATgames systems! I now have the Atari flashback and this one working well. Now to work on the Sega flashback 2017 Dash and 2018 custom firmware's.
 
  • Like
Reactions: rrifonas

rrifonas

Well-Known Member
OP
Member
Joined
Jan 28, 2009
Messages
258
Trophies
1
XP
1,265
Country
United States
@rrfonas excellent work! I installed the previous firmware version last week and was exited only to get to Mame Defender and find it hangs. Now it’s nearly perfect with the Williams firmware fix. Thanks for the hard work in the ATgames systems! I now have the Atari flashback and this one working well. Now to work on the Sega flashback 2017 Dash and 2018 custom firmware's.
Thanks.
There is a couple of custom firmware for Sega Flashback 2018, one unlocks all extensions (adding support for Master System, Game Gear and Sega CD from SD Card), and other adding support for Picodrive (it fixes PAL games and have 32x support, but it breaks GG and Sega CD). Unfortunately the menu app has only one slot to add cores so it's no possible to have Genesis Plus GX and Picodrive in the same partition.
I've made "something" for the Genesis Flashback HD 2017 but I'm still struggling with a "legal issue" - I could replace the built-in emulator with MD.Emu, which is "free" if you compile for yourself. I've also added support to load RetroArch as it is a game in the launcher, and I may release this mod. Unfortunately it's not possible to launch the games directly with RetroArch.
 

markwkidd

Member
Newcomer
Joined
Mar 30, 2018
Messages
20
Trophies
0
Age
53
XP
95
Country
United States
Hi folks. I'm one of the maintainers of the MAME 2003 and MAME 2003-Plus. I'm also a contributor to MAME 2000. Thanks for your work to make improved versions available on this platform!

I wanted to let you know that if you are making changes and improvements to the cores in order to make them function better in this environment, we're very friendly to PRs upstream. For example, we've helped work with (S)NES Classic, PSX Classic, and Switch hackers to ensure that the MAME cores work well in those environments.

I don't generally monitor these forums, but if you tag me I'll try to take a look. The best ways to contact me and the other MAME 2003 coders are our github repo at https://github.com/libretro/mame2003-plus-libretro or the #programming channel of the libretro Discord server at https://discord.gg/C4Huaca

Thanks again!
 

Zaphod77

Well-Known Member
Member
Joined
Aug 25, 2015
Messages
665
Trophies
0
Age
49
XP
615
Country
United States
no these are just recompiled binaries he's dropping in. they are unmodified.

but the system directory is not always writable. So changing the code to default to making a subdirectory off of the content directory, or or where the rom is loaded from if that fails would be a big improvement. ANother improvement would be adding nvram bootstraps to mame 2000.
 

rrifonas

Well-Known Member
OP
Member
Joined
Jan 28, 2009
Messages
258
Trophies
1
XP
1,265
Country
United States
Hi folks. I'm one of the maintainers of the MAME 2003 and MAME 2003-Plus. I'm also a contributor to MAME 2000. Thanks for your work to make improved versions available on this platform!

I wanted to let you know that if you are making changes and improvements to the cores in order to make them function better in this environment, we're very friendly to PRs upstream. For example, we've helped work with (S)NES Classic, PSX Classic, and Switch hackers to ensure that the MAME cores work well in those environments.

I don't generally monitor these forums, but if you tag me I'll try to take a look. The best ways to contact me and the other MAME 2003 coders are our github repo at https://github.com/libretro/mame2003-plus-libretro or the #programming channel of the libretro Discord server at https://discord.gg/C4Huaca

Thanks again!

Hi markwkidd, Thank you to post here, I really appreciate your input here!

I've seen that MAME 2003 (and MAME 2003 Plus) have the issue with the default path to create the 'mame2003' folder fixed, if it can't get the system variables from the 'front-end' (RetroArch), then it fallback to the "Content Directory" (aka ROMs directory). MAME 2000, in other hand, tries to create a directory called "(null)" under the same path as the executable calling the core, which is a problem for the Atgames device as the partition with the emulator is read-only. This "null" comes from some variables set in libretro.c.

I think I know how to fix it by trying to merge the changes from MAME 2003 Plus into libretro.c, the only problem is that I've never compiled any libretro core for Linux on ARM (I've done with Android before). The change will allow the core to create the 'mame2000' folder structure to store nvram data, game settings and maybe hi-scores in the same place as the ROMs are stored in SD Card.
I will check if I can implement the changes and compile the core by myself, and I will get in touch using these channels (GitHub or Discord) if I have questions.
 

SchmalzTech

New Member
Newbie
Joined
Jan 30, 2019
Messages
2
Trophies
0
Age
54
XP
53
Country
United States
So maybe I have bunk ROMs, but I loaded the firmware and tried to get it to see ROMs on the SD card after removing the firmware update files from it and reinserting, and I don't see any. Do I need them in a subdirectory on the SD card? It's formatted FAT32. I tried naming the .zip files to .zim, and also recompressed some to .7z files and all I see is the stock games.
 

Zaphod77

Well-Known Member
Member
Joined
Aug 25, 2015
Messages
665
Trophies
0
Age
49
XP
615
Country
United States
the firmware update MUST be named "arcade_update.img", and MUST be in the root of the card.

roms go in a folder named GAME (all upper case), and must have no spaces in filename.

having done so they will be in the SD Card section.
 
Last edited by Zaphod77,

markwkidd

Member
Newcomer
Joined
Mar 30, 2018
Messages
20
Trophies
0
Age
53
XP
95
Country
United States
Hi markwkidd, Thank you to post here, I really appreciate your input here!

I've seen that MAME 2003 (and MAME 2003 Plus) have the issue with the default path to create the 'mame2003' folder fixed, if it can't get the system variables from the 'front-end' (RetroArch), then it fallback to the "Content Directory" (aka ROMs directory). MAME 2000, in other hand, tries to create a directory called "(null)" under the same path as the executable calling the core, which is a problem for the Atgames device as the partition with the emulator is read-only. This "null" comes from some variables set in libretro.c.

I think I know how to fix it by trying to merge the changes from MAME 2003 Plus into libretro.c, the only problem is that I've never compiled any libretro core for Linux on ARM (I've done with Android before). The change will allow the core to create the 'mame2000' folder structure to store nvram data, game settings and maybe hi-scores in the same place as the ROMs are stored in SD Card.
I will check if I can implement the changes and compile the core by myself, and I will get in touch using these channels (GitHub or Discord) if I have questions.

Do I understand correctly that the Atari device is using RetroArch as the mame2003 frontend?

If so, is it the case that you cannot change the RetroArch settings in retroarch.cfg in order to designate a different libretro SYSTEM path?
 

rrifonas

Well-Known Member
OP
Member
Joined
Jan 28, 2009
Messages
258
Trophies
1
XP
1,265
Country
United States
Do I understand correctly that the Atari device is using RetroArch as the mame2003 frontend?

If so, is it the case that you cannot change the RetroArch settings in retroarch.cfg in order to designate a different libretro SYSTEM path?

No, that's not correct. The device running MAME 2003 plus is the Legends Flashback, which emulates some arcade games and Atgames is using a custom core with only the licensed games enabled. They also have their own emulator to load the cores so we don't have retroarch.cfg.

While 'playing' with this device, I've added support to MAME 2000 core, and it has been working well except for games requiring to read the nvram to run (Williams games). I've seen the code to set the directories in MAME 2000 is different from MAME 2003 (plus), causing the core to create a directory "(null)" if the 'front-end' is not passing the content_path. I could copy the newer code and include into MAME 2000. I've attached libretro.c with the changes if you want to validate or potentially include in the repository.

With that said, I've been able to compile a working MAME 2000 core with this fix implemented, and it is working fine. With the right hardware and packages it's not that difficult to build it. The only 'hack' I'm still using in this core is to 'mask' zip files as 'zim'. It is needed to avoid conflict with the original core in this device, the menu in this device load the cores based on file extension. I've started to look at the code to read zip files but it was too difficult to change it in the code so I've just 'hacked' the extension with a hexadecimal editor. I may try to improve this later.

Anyway, now there is a 'clean' solution to run the Williams games and arcade games saving data to nvram. If anyone want to try it, I'm updating the first post with the link to this update, which I think it will be the definitive update for this device with the current firmware version (v2.6)
 

Attachments

  • libretro.c.txt
    25.4 KB · Views: 210

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: Nah we have well established 401ks health insurance and paid daily