Giter VIP home page Giter VIP logo

rustboyadvance-ng's People

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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rustboyadvance-ng's Issues

WWF Road to WrestleMania - Invalid mode 6 graphics mode

The emulator panics right after the BIOS logo because the game tries to set an invalid, mode 6 graphics mode. Should it be silently ignored? Is this a part of an anti-emulation trick or just garbage game code?

Not to be confused with WWE Road to WrestleMania X8.

RTC

No RTC emulation, needed mostly for pokemon games.
Adding RTC will solve these messages

image

Segmentation fault in SysBus::read_8

Affected game:

  • Power Rangers - Ninja Storm (USA)

Backtrace:

Thread 1 "rustboyadvance-" received signal SIGSEGV, Segmentation fault.
0x000055555562e029 in <rustboyadvance_core::sysbus::SysBus as rustboyadvance_core::bus::Bus>::read_8 ()
(gdb) bt
#0  0x000055555562e029 in <rustboyadvance_core::sysbus::SysBus as rustboyadvance_core::bus::Bus>::read_8 ()
#1  0x00005555555fe94d in rustboyadvance_core::arm7tdmi::thumb::exec::<impl rustboyadvance_core::arm7tdmi::cpu::Core>::do_exec_thumb_ldr_str ()
#2  0x00005555555fec05 in rustboyadvance_core::arm7tdmi::thumb::exec::<impl rustboyadvance_core::arm7tdmi::cpu::Core>::exec_thumb_ldr_str_imm_offset ()
#3  0x000055555560054d in rustboyadvance_core::arm7tdmi::cpu::Core::step ()
#4  0x00005555555fa336 in rustboyadvance_core::gba::GameBoyAdvance::step ()
#5  0x00005555555fa1b6 in rustboyadvance_core::gba::GameBoyAdvance::frame ()
#6  0x00005555555be914 in rustboyadvance_sdl2::main ()
#7  0x00005555555c44c3 in std::rt::lang_start::{{closure}} ()
#8  0x00005555557c3ac8 in std::rt::lang_start_internal::{{closure}} () at src/libstd/rt.rs:52
#9  std::panicking::try::do_call () at src/libstd/panicking.rs:331
#10 std::panicking::try () at src/libstd/panicking.rs:274
#11 std::panic::catch_unwind () at src/libstd/panic.rs:394
#12 std::rt::lang_start_internal () at src/libstd/rt.rs:51
#13 0x00005555555c0042 in main ()

Graphical glitch in Megaman Zero 3

The distortion effect used for MISSION START label lingers on after the animation finishes, causing the UI layer to look like that.
rocket3bug2

The distortion effect is implemented with HBlank interrupts, whenever the animation finishes the HBlank IRQ handler may disable the HBLANK_IRQ_ENABLE bit of REG_DISPSTAT. This only happens when REG_VCOUNT value is 160 as can be seen below:
image

Due to improper emulation of the GPU, HBLANK Interrupts are not triggered when the Gpu is in VBlank state, thus VCOUNT will never be 160 (0xa0) and HBLANK_IRQ_ENABLE bit never gets cleared.

"attempt to subtract with overflow" when rendering second frame

I'm using rustboyadvance-ng/core for a personal project. It seems to work fine in release mode (as runtime overflow checks are disabled), but in development I run into this error when attempting to render the second frame. The bios frames and first frame of the game itself render fine.

Reproduction of the issue can be found here: https://github.com/SkyLeite/pokecord/tree/0b69d9ae03491ca2190e6cdcf52fb5710925f197

warning: `pokecord` (bin "pokecord") generated 6 warnings
    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/debug/pokecord`
Rendered!
First frame rendered!
thread 'main' panicked at 'attempt to subtract with overflow', rustboyadvance-ng/core/src/gpu/mod.rs:464:47
stack backtrace:
   0:     0x5579b61468ec - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb16b437de6ab6276
   1:     0x5579b6171bde - core::fmt::write::h8f8bef23583ee234
   2:     0x5579b614d0c1 - std::io::Write::write_fmt::h8486efe074824056
   3:     0x5579b61544be - std::panicking::default_hook::{{closure}}::hdfa4615b29a34cb8
   4:     0x5579b6154127 - std::panicking::default_hook::h60ffd169fe7df297
   5:     0x5579b61549d1 - std::panicking::rust_panic_with_hook::hf0183b899953e185
   6:     0x5579b6146ea9 - std::panicking::begin_panic_handler::{{closure}}::h93eac1c61f0beba3
   7:     0x5579b6146cc4 - std::sys_common::backtrace::__rust_end_short_backtrace::he4788588c206eaab
   8:     0x5579b6154682 - rust_begin_unwind
   9:     0x5579b5e68813 - core::panicking::panic_fmt::h20a31c8e90ca0d37
  10:     0x5579b5e686dd - core::panicking::panic::h95bb893ef3e7cb7f
  11:     0x5579b5ec92be - rustboyadvance_core::gpu::Gpu::on_event::ha2e8b68811dd5add
                               at /mnt/hdd/projects/pokecord/rustboyadvance-ng/core/src/gpu/mod.rs:464:47
  12:     0x5579b5edd4c6 - rustboyadvance_core::gba::GameBoyAdvance::handle_event::hda667049d6b7e2c7
                               at /mnt/hdd/projects/pokecord/rustboyadvance-ng/core/src/gba.rs:310:38
  13:     0x5579b5edd2b2 - rustboyadvance_core::gba::GameBoyAdvance::run::hc95f87805a33d994
                               at /mnt/hdd/projects/pokecord/rustboyadvance-ng/core/src/gba.rs:288:17
  14:     0x5579b5edcd8a - rustboyadvance_core::gba::GameBoyAdvance::frame::h10956a8c82e3b727
                               at /mnt/hdd/projects/pokecord/rustboyadvance-ng/core/src/gba.rs:222:25
  15:     0x5579b5e6e027 - pokecord::main::hf48fb910a058991b
                               at /mnt/hdd/projects/pokecord/src/main.rs:77:14
  16:     0x5579b5e69f7b - core::ops::function::FnOnce::call_once::h794bd1593b72e1e2
                               at /build/rustc-1.63.0-src/library/core/src/ops/function.rs:248:5
  17:     0x5579b5e68b9e - std::sys_common::backtrace::__rust_begin_short_backtrace::hdded08256cdf329e
                               at /build/rustc-1.63.0-src/library/std/src/sys_common/backtrace.rs:122:18
  18:     0x5579b5e68b61 - std::rt::lang_start::{{closure}}::h010441cf4be51538
                               at /build/rustc-1.63.0-src/library/std/src/rt.rs:145:18
  19:     0x5579b614c9d5 - std::rt::lang_start_internal::h3e617fbe87035bdb
  20:     0x5579b5e68b30 - std::rt::lang_start::hda90f78f082db313
                               at /build/rustc-1.63.0-src/library/std/src/rt.rs:144:17
  21:     0x5579b5e6e0cc - main
  22:     0x7f1956160237 - __libc_start_call_main
  23:     0x7f19561602f5 - __libc_start_main_impl
  24:     0x5579b5e689b1 - _start
                               at /build/glibc-2.34/csu/../sysdeps/x86_64/start.S:116
  25:                0x0 - <unknown>

Panic on invalid CPU modes

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', rustboyadvance-core/src/arm7tdmi/psr.rs:73:9

Games hitting this panic:

  • Madden NFL 2002 (after the BIOS logo)
  • Starsky & Hutch (after starting a new game)
  • Ultimate Muscle - The Kinnikuman Legacy
  • Banjo-Kazooie - Grunty's Revenge
  • The Powerpuff Girls - Mojo Jojo A-Go-Go
  • Colin McRae Rally 2.0
  • Gauntlet - Dark Legacy

Performance could be better

When running in unbounded fps (holding down space button), the emulator underperforms compared against other emulators.

Building on macOS arm64

I needed to perform these steps to be able to build this project on my arm64 macOS:

brew install SDL2 SDL2_image
export LIBRARY_PATH="$LIBRARY_PATH:/opt/homebrew/lib"
cargo run --release -- path/to/rom

Possible NULL deref in pokemon emerald

When logging invalid memory writes I noticed pokemon emerald tries to read from a NULL pointer during the fade out animation in the naming screen (right after the players confirm their name)

The problematic function is called GetTextCaretPosition, and this is the instruction that loads the global pointer gNamingScreenData

080e4a46 04 68           ldr        r4,[r0,#0x0]=>gNamingScreenData                  = ??

gNamingScreenData is set to NULL when waiting for the fade to finish in the following function

static bool8 MainState_WaitFadeOutAndExit(void)
{
    if (!gPaletteFade.active)
    {
        if (gNamingScreenData->templateNum == NAMING_SCREEN_PLAYER)
            SeedRngAndSetTrainerId();
        SetMainCallback2(gNamingScreenData->returnCallback);
        DestroyTask(FindTaskIdByFunc(sub_80E31B0));
        FreeAllWindowBuffers();
        FREE_AND_SET_NULL(gNamingScreenData);
    }
    return FALSE;
}

But for some reason GetTextCaretPosition still gets called every frame causing this NULL deref.

Possibly a real bug in the game itself?

Audio cracking issue on Android in turbo mode

i also have problem with audio if i turn on turbo mode or change frame rate of emulator... audio cracks and Logs show this message . Games run perfectly but only audio has some cracking

I/chatty: uid=10539(com.mrmichel.rustdroid_emu) Thread-4 identical 25 lines
W/EmulatorBindings: : failed to push audio sample
W/EmulatorBindings: : failed to push audio sample
I/chatty: uid=10539(com.mrmichel.rustdroid_emu) Thread-4 identical 3752 lines
W/EmulatorBindings: : failed to push audio sample
W/EmulatorBindings: : failed to push audio sample
I/chatty: uid=10539(com.mrmichel.rustdroid_emu) Thread-4 identical 26652 lines
W/EmulatorBindings: : failed to push audio sample
W/EmulatorBindings: : failed to push audio sample

Emulate "bugs"

Some games are buggy, and since the hardware emulation is nowhere near perfect at the moment,
These bugs break these games on this emulator (while on real hardware, they don't break).

Some of the broken games:

  • Legend of Zelda - The Minish Cap
  • Megaman Battle Network (series) - crashes when reading emails

Need to

  • Properly emulate "open bus" behavior
  • Properly emulate read from system ROM (bios) when CPU is running code outside of system ROM

Update gba-suite

gba-suite has been updated, and these tests now have a bitmap UI.
Also, need to make sure the tests (suchs as test_arm7tdmi_arm_eggvance) are updated accordingly.

Will not compile with cargo build --release

Cloned the repo, ran 'cargo build --release' on commit 1dfdec3 and get this error:

error :


warning: `rustboyadvance-core` (lib) generated 4 warnings
error: couldn't read platform/rustboyadvance-sdl2/src/../../../external/SDL_GameControllerDB/gamecontrollerdb.txt: No such file or directory (os error 2)
  --> platform/rustboyadvance-sdl2/src/main.rs:66:9
   |
66 |         include_str!("../../../external/SDL_GameControllerDB/gamecontrollerdb.txt");
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: unused import: `io`
 --> platform/rustboyadvance-sdl2/src/options.rs:1:11
  |
1 | use std::{io, path::PathBuf};
  |           ^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: `rustboyadvance-sdl2` (bin "rustboyadvance-sdl2") generated 1 warning
error: could not compile `rustboyadvance-sdl2` due to previous error; 1 warning emitted

Panic - attempt to subtract with overflow

Thanks for the emulator! Every game I tried running rustboyadvance-sdl2 with triggered a subtraction overflow panic. Here's the log for Pokemon Emerald:

INFO [rustboyadvance_sdl2] Initializing SDL2 context
INFO [rustboyadvance_sdl2] No game controllers were found
INFO [rustboyadvance_sdl2::audio] Found audio device: AudioSpec { freq: 44100, format: S16LSB, channels: 2, silence: 0, samples: 2048, size: 8192 }
INFO [rustboyadvance_sdl2::audio] ringbuffer size = 8192
INFO [rustboyadvance_core::cartridge::builder] Loaded ROM: CartridgeHeader { game_title: "POKEMON EMER", game_code: "BPEE", maker_code: "01", software_version: 0, checksum: 114 }
INFO [rustboyadvance_core::cartridge::builder] Found game overrides for BPEE: GameOverride {
    force_rtc: true,
    save_type: None,
}
INFO [rustboyadvance_core::cartridge::builder] Detected Backup: Flash1M
INFO [rustboyadvance_core::cartridge::builder] Emulating RTC!
INFO [rustboyadvance_core::gba] Verified bios rom
INFO [rustboyadvance_core::sound] MSE enabled!
INFO [rustboyadvance_core::sound] bias - setting sample frequency to 32768hz
INFO [rustboyadvance_core::sound] MSE disabled!
thread 'main' panicked at core/src/gba.rs:218:25:
attempt to subtract with overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I was able to have the game run, after replacing the subtraction in core/src/gba.rs with .saturating_sub. I'll do a pull request in a second.

Incorrect affine transformations in Wario Land 4

Upon entering a new stage in Wario Land 4 there's an animation of a rotating vortex. It should be rotating at the dead center of the screen, however RustBoyAdvance-NG currently renders it off-center. The rotation also glitches twice during the animation.

Screenshot:

Expected rendering (mGBA master):

NFL Blitz 20-02 (USA) - Glitch

The game intro sequence is rushing through at 100000x speedup and gets stuck on a black screen.

nfl_blitz

(The emulator runs at 60FPS in this recording)

Missing forced blanking implementation

This can cause short graphical glitches on scene transitions, when games perform large VRAM updates while expecting the GPU to draw nothing.

The only visible example of this I currently know is the magenta colored screen flash when opening the in-game menu in DBZ Legacy of Goku.

Android application

Thanks for the great work!
Can you update instructions for how to build it with Android Studio, or is there an existing APK for Android? Just want to try it on my phone : )

Not cycle accurate

The ARM7TDMI emulation isn't counting cycles accurately.
Need to pass most of the mgba-suite timing test

image

Pacman - Collection bad coin placement

image

The placements of the coins is off.
I'm suspecting this is an emulator bug rather than a gpu bug since the values of BGxHOFS BGxVOFS correspond to noGBA, so probably the game miscalculates the positions of the coins.

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.