OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Dec 11, 2018 11:18 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Some ideas for battery (saves) and controller input
PostPosted: Mon Dec 03, 2018 6:08 pm 
Offline

Joined: Mon Dec 03, 2018 4:10 pm
Posts: 2
I have a static machine image that I have an embedded gameboy color emulator inside. The OS doesnt really have a good disk driver or writable filesystem, so I need some ideas for how to save games. The GBC battery state is either 32kb (most times) or 128kb (sometimes).
My idea is to use a REST endpoint to send and receive savedata. Is there any other simpler way to do this? On bare metal the network solution seems best.

Another thought was controlling the emulator with joypad by reading linux /dev/input/js0: character special (13/0)
Then parsing that data and sending the button/axis states over network... again.

Do you know of anything that already parses joystick data and sends it over network? If so I would like to just use it. Wouldnt have to reinvent the wheel.

Fun fact, the screen is in 13h and since it only has 256 colors I have to trap on palette changes in the emulator and write the palette to VGA. I also do a color scaling to make the colors more appealing.
Its happening here: https://github.com/fwsGonzo/gamebro/blo ... ce.cpp#L97

One last question. 13h is 320x200, is it pointless to try to scale up the image in the emulator with this low resolution? I cant imagine it would look good. The DMG/CGB screen is 160x144 pixels.
And bonus fun fact: DMG is acronym for Dot Matrix Game which was the working title for the original Gameboy!

Thanks!
gonzo


Top
 Profile  
 
 Post subject: Re: Some ideas for battery (saves) and controller input
PostPosted: Tue Dec 04, 2018 2:30 am 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 917
This might be helpful for scaling.


Top
 Profile  
 
 Post subject: Re: Some ideas for battery (saves) and controller input
PostPosted: Tue Dec 04, 2018 9:58 am 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 84
@gonzo: I don't quite get you. Are you on bare metal or on Linux? Because if the former, nothing is stoppinng you from designating a disk partition as your save file. And if the latter then I don't know why you can't just save on disk somewhere.

As for the rest, you could probably just use netcat to send /dev/js0 to the network. That data is already interpreted. I don't think encapsulating it in JSON or something will add anything to your process. Same with the save data. I like netcat, it is so versatile.

But all of that means you have to implement a TCP/IP stack in addition to a GB emulator. You sure about this?


Top
 Profile  
 
 Post subject: Re: Some ideas for battery (saves) and controller input
PostPosted: Wed Dec 05, 2018 9:50 am 
Offline

Joined: Mon Dec 03, 2018 4:10 pm
Posts: 2
nullplan wrote:
@gonzo: I don't quite get you. Are you on bare metal or on Linux? Because if the former, nothing is stoppinng you from designating a disk partition as your save file. And if the latter then I don't know why you can't just save on disk somewhere.

As for the rest, you could probably just use netcat to send /dev/js0 to the network. That data is already interpreted. I don't think encapsulating it in JSON or something will add anything to your process. Same with the save data. I like netcat, it is so versatile.

But all of that means you have to implement a TCP/IP stack in addition to a GB emulator. You sure about this?


We already have a TCP/IP stack in modern C++ and a read-only filesystem. The OS is made for network functions, so its static and not configurable during run-time. It can run just fine on bare metal. I guess you are right about netcat, good idea. I will try to do that. I really want to control it with my gamepad.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group