GithubHelp home page GithubHelp logo

jptiz / libgba-cpp Goto Github PK

View Code? Open in Web Editor NEW
38.0 3.0 7.0 915 KB

C++ Library for Game Boy Advance Development

License: MIT License

C++ 94.01% Assembly 4.41% Meson 1.58%
cpp gameboyadvance gameboy-advance-development gba-development library game-engine hacktoberfest

libgba-cpp's Issues

screenshots of samples

Hello I have compiled the samples but I see some red lines, is this expected?

It would be nice to have screenshots of samples so I can compare against my build.

Make setup.sh an actual setup (or switch to a `make` subcommand)

Currently, setup.sh exists just to a quick workshop I lectured years ago and everything it does is...

#!/usr/bin/bash
export LIBGBA=$(pwd)

...pretty self-explanatory. It would be nice to make it actually do something useful - or even remove it or switch into make commands.

Make writable graphics API

Scenary

Currently all data must bem const to be placed in ROM. This is done this way because there is only 32KB in SRAM (+256KB in DRAM), and graphics potentially use much more than that (and there still need space for game data while playing).

Ideas

No idea from where to start, actually. Maybe with palette?

Documentation: add tutorials for the library API usage

Even I find myself lost when I'm going to use this API after a long time without usage. Having small tutorials with simple tasks will not only be very cute and help teaching GBA mechanics, but also improve the usability of this library a lot.

Add SFX and Music support

Scenery

Currently there's no working SFX implementation. There are some tests on a specific branch. For music, #6 will be needed.

Where to start

One could read about sound register in the technical manual to implement a simple API to access them, and then read about Interrupt Control to make audio play using interrupts. With those two, plus DMA transfer, audio frequencies may be transferred to each channel's FIFO and then music should play.

Hints

These may help:

documentation links to itself

your "API docs" contain pretty much the same as the readme and the link to the "API docs" inside it link to the same page again.

Move away from makefiles

Currently the system use a very handmade Makefile structure as a build system. Using cmake (EDIT: or meson!) could be a good choice.

To set the ARMv7TDMI compiler, this CMAKE line could be useful:

set(CMAKE_CXX_COMPILER <something>)

In meson, it would be through a cross-file.

Master is broken

Okay, after MONTHS without touching this thing properly I realized master branch is broken, which is unnacceptible. Who in hell made this?

$ git blame src/arch/display/video.cpp
40891023 src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2018-07-17 12:56:27 -0300  1) #include <libgba-cpp/arch/display/video.h>
f9070b92 src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2018-07-17 13:11:19 -0300  2) #include <libgba-cpp/utils/general.h>
ba7f6d3a src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-09-23 21:39:36 -0300  3) 
ba7f6d3a src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-09-23 21:39:36 -0300  4) namespace {
ba7f6d3a src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-09-23 21:39:36 -0300  5) 
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200  6) using gba::display::Page;
1c0993f5 src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-09-26 12:02:43 -0300  7) using gba::display::Color;
f8101474 src/arch/display/video.cpp    (João Paulo Taylor Ienczak Zanette 2018-07-26 19:26:57 -0300  8) using gba::display::RawPalette;
ba7f6d3a src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-09-23 21:39:36 -0300  9) using gba::display::VRAMData;
ba7f6d3a src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-09-23 21:39:36 -0300 10) 
ba7f6d3a src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-09-23 21:39:36 -0300 11) static auto& vram_data = *new (reinterpret_cast<void*>(0x0600'0000)) std::array<VRAMData, 0x18000 / 2>{};
ba7f6d3a src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-09-23 21:39:36 -0300 12) 
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200 13) static auto page = Page::PAGE1;
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200 14) 
ba7f6d3a src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-09-23 21:39:36 -0300 15) }
ba7f6d3a src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-09-23 21:39:36 -0300 16) 
ba7f6d3a src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-09-23 21:39:36 -0300 17) std::array<VRAMData, 0x18000 / 2>& gba::display::vram_data() {
ba7f6d3a src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-09-23 21:39:36 -0300 18)     return ::vram_data;
ba7f6d3a src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-09-23 21:39:36 -0300 19) }
ba7f6d3a src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-09-23 21:39:36 -0300 20) 
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200 21) Color& gba::display::mode5::vram(int x, int y) {
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200 22)     return vram(x  + screen_width * y);
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200 23) }
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200 24) 
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200 25) Color& gba::display::mode5::vram(int index) {
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200 26)     return vram_data()[index + utils::value_of(::page) * screen_width * screen_height].color;
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200 27) }
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200 28) 
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200 29) Page gba::display::mode5::page() {
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200 30)     return ::page;
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200 31) }
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200 32) 
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200 33) void gba::display::mode5::flip_pages() {
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200 34)     select_page(::page);
f8101474 src/arch/display/video.cpp    (João Paulo Taylor Ienczak Zanette 2018-07-26 19:26:57 -0300 35) 
f8101474 src/arch/display/video.cpp    (João Paulo Taylor Ienczak Zanette 2018-07-26 19:26:57 -0300 36)     constexpr auto PAGE0 = Page::PAGE0;
f8101474 src/arch/display/video.cpp    (João Paulo Taylor Ienczak Zanette 2018-07-26 19:26:57 -0300 37)     constexpr auto PAGE1 = Page::PAGE1;
f8101474 src/arch/display/video.cpp    (João Paulo Taylor Ienczak Zanette 2018-07-26 19:26:57 -0300 38)     ::page = ::page == PAGE0 ? PAGE1 : PAGE0;
972fdf7e src/drivers/display/video.cpp (João Paulo Taylor Ienczak Zanette 2017-11-02 02:09:17 -0200 39) }

Oh damn, it was me. Every line.

I'm sorry everyone, I shall fix this. ASAP.

Add DMA support

Scenery

DMA (Direct Memory Access) helps transfering huge amounts of data while leaving CPU alone to do other things. This is necessary for playing music in proper ways, and for some cool visual effects. There's currently no DMA implementation nor sketch.

Where to start

Try to follow TONC's DMA tutorial.

Investigate GBA memory access issues

In a recent pong game development, I noticed sometimes memory-mapped register access does not work as expected in runtime.

Running mgba-qt with console logs enabled, the following is shown ("ERRO DO JOGO" = "Game error"):

ERRO DO JOGO] GBA I/O: Write to read-only I/O register: 006
[ERRO DO JOGO] GBA Video: Invalid video register: 0x056
[ERRO DO JOGO] GBA DMA: Invalid DMA source address: 0x00000000
[ERRO DO JOGO] GBA DMA: Invalid DMA source address: 0x00000000
[ERRO DO JOGO] GBA DMA: Invalid DMA source address: 0x00000000
[ERRO DO JOGO] GBA DMA: Invalid DMA source address: 0x00000000

Which might point out to the cause.

Possible solution

To not "reinvent the wheel" and spend to much time figuring out what's wrong in the memory access, it would be better to just build the API as a thin wrapper to https://github.com/devkitPro/libgba.

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.