Giter Club home page Giter Club logo

magenboy's People

Contributors

alloncm avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

magenboy's Issues

Improve boot time on the RaspberryPi

Currently the setup described the RaspberryPi section takes about 15 seconds to boot, I want to cut it to 1-3 seconds to achieve an authentic feeling as much as I can.

I believe running bare metal could help achieve this goal.

This issue depends on this #123 and is used to collect all the resources in one place

Finish Raspberry pi baremetal port

There are still uncompleted tasks:

  • Merge the rpi_gpio module to the baremetal project to create a RPI project with feature to run baremetal (the peripherlas are really look alike in the code base)
  • Add support for roms-folder from the image sd card
  • Support proper shutdown from software side
  • Add support for saves
  • Support other rpi's and cpu's, currently the code is only tested on cortex-a72 (and some code assumes it compiled only for this cpu) so add support for other cpu's and arrange the code for that
    • replace the target-feature=+virtualization with target-cpu=cpu for the compiled cpu
    • Add .ifdef where necessary to add support for coretx-a53 and more
    • Add a rendering core that will handle the rendering to boost performance - Not sure if necessary (on RPI4 its not but might be on zero2)
  • More testing on hardware (hopefully get another rpi zero2)

Allow RealMagenBoy to load new roms from a uart port

The emulator will have a port for "technician" which will allow to read logs from the uart and when choose upload new rom in the menu will allow the user to upload a rom to the gameboy.

Perhaps there will be a program from the other side which will stream the rom and communicate with the emulator

code improvements

  • use trait default implementation in the mbc
  • try use impl instead if dyn when passing the Memory trait to the opcodes

Implement a FIFO PPU

This will give a better emulation accuracy and I'm believe a faster emulation too.

Choose rom option

Add an folder that the user could add roma to and upon start could choose to be prompt with a menu to select a game.

Could use the dialoguer lib

Pull audio segfaults on linux

I had those two errors on RPI linux:
When using the manual resampler:

malloc(): invalid size (unsorted)

When using sdl resampler:

free(): invalid pointer

when activating the push-audio feature the error will no longer occur

Add support for gameboy color

In order to do that there are a few areas that will need to change

  • Detect rom target machine (CGB/DMG)
  • CPU - support double speed mode, including enable and disable double speed mode
  • PPU -
    • Support the CGB pallets
    • Object priority changes in CGB mode (place in OAM memory and not X value)
    • BG map priority table
  • MMU
    • Support the expanded vram and ram
    • Support the new vram dma contoller
    • Support the CGB bootrom

Solve the performance issue

The emulator barely runs at 120 fps without the sound implemented.

After the sound it will barely run at 60 fps (on an I7 machine)

Sound accuracy

Current state

The sound gets de-synced from the video over time.

In order to solve this every time Im pushing new sound to the sound device (right now to SDL) Im blocking until the samples queue is almost empty and only than pushing the buffer.

Reasons

I believe the de-syncing happens for 2 reasons:

  • Right now Im calculating the ratio of Emulator samples per actual sample with the original GB frequency.
    The problem is that since Im not stepping this amount of cycles per second but slightly more (since Im running at 60 fps and not 59.7... fps like the original GB) Im producing more samples than I have time to output.
  • Another reason for this is that Im saving the amount of samples to skip as an integer and no floating point, cause of that I might lose precision when skipping samples and could have more samples than necessary.

Proper solution

Running the emulator at the correct original fps and using float to calculate the samples to skip.

Cycle accurate emulation

Currently the PPU is almost ready (line based not pixel based)
The CPU is not ready and once is ready needs to pass the passed cycles to the PPU

Note to self:

Once ready fix the MMU to block VRAM and OAM

Fetch the opcodes faster

I think could be done with two matches ine for the to get opcode type enum and one to run the the specific enum with the func pointer

Sound sync

Sync the sound using the callback api of sdl and not the push api.

It will grant a better performance at the cost of another thread.

Blargg's test 11 bugs

Save MBC state

The idea

In order to save the state of the game some games have an battery packed MBC that allow them to save the sate of the game to the MBC.

I want to support that and for this Ill need some way of access to the MBC from outside the gameboy (that should be multi platform).

Solution

I can drop the gameboy as the program receive close signal and only pass the MBC as & mut so Ill still have access to it after.

Screen tearing

The problem

The screen is tearing

The frame isnt being drawn in the end, but all over the place (not LY = 153 but all kinds of LY's).

Solutions

  • Accurate emulation could solve it, only the amount of opcodes needed would run until the screen would be drawn.
  • Double buffering could help with the tearing, switch the buffers only when finishing to draw.
  • Fetching the buffer only when finishing the PPU finishes to draw.

Refactor the DMA controller

Right now the dma is inside the gb_mmu, mainly because it needs access the mmu and needs to be under the io_bus in order to expose its memory interface to the mmu.

I think that by making another bus for regular memory (addresses 0x0 - 0xFDFF) we can separate the dma implementation to its own independent structure.

Hopefully it wont harm performance :)

Add quick saves

Add the option to save the state of a game anywhere I want (also support for saves in games that do not support it).

Improve performance

In order to run on weaker hardware I want to improve performance as much as I can.

In order to do that I opened a new branch called feature/mt, a PR will be opened soon.

In this branch I will convert the program to 2 threads (or maybe 3) in order to move the IO from the logic thread.
When doing this I need to figure out how to draw properly without busy waiting in the IO thread for new frame buffer from the emulation thread while not making the window unresponsive in case the PPU is turned off.

This be achievable with blocking function that has a timeout, when the timeout is set the function will update the UI (accept new events) and than block again for the amount of time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.