Refactor workspace structure
Former-commit-id: d6ab90563fa209b431661086f9ec2672bda02a96
This commit is contained in:
parent
97fac000b0
commit
884f39ca8f
48
Cargo.lock
generated
48
Cargo.lock
generated
|
@ -981,29 +981,7 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustboyadvance-jni"
|
name = "rustboyadvance-core"
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"android_log 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"jni 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"ringbuf 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"rustboyadvance-ng 0.1.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustboyadvance-minifb"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"bit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"minifb 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"rustboyadvance-ng 0.1.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustboyadvance-ng"
|
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1033,6 +1011,28 @@ dependencies = [
|
||||||
"zip 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"zip 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustboyadvance-jni"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"android_log 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"jni 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"ringbuf 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rustboyadvance-core 0.1.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustboyadvance-minifb"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"bit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"minifb 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rustboyadvance-core 0.1.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustboyadvance-sdl2"
|
name = "rustboyadvance-sdl2"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -1043,7 +1043,7 @@ dependencies = [
|
||||||
"flexi_logger 0.14.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"flexi_logger 0.14.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ringbuf 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ringbuf 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustboyadvance-ng 0.1.0",
|
"rustboyadvance-core 0.1.0",
|
||||||
"sdl2 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"sdl2 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"spin_sleep 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"spin_sleep 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winres 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winres 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
68
Cargo.toml
68
Cargo.toml
|
@ -1,61 +1,7 @@
|
||||||
[package]
|
[workspace]
|
||||||
name = "rustboyadvance-ng"
|
members = [
|
||||||
version = "0.1.0"
|
"rustboyadvance-core/",
|
||||||
authors = ["Michel Heily <michelheily@gmail.com>"]
|
"platform/rustboyadvance-sdl2",
|
||||||
edition = "2018"
|
"platform/rustboyadvance-minifb",
|
||||||
|
"bindings/rustboyadvance-jni",
|
||||||
[workspace]
|
]
|
||||||
members = [
|
|
||||||
"platform/rustboyadvance-sdl2",
|
|
||||||
"platform/rustboyadvance-minifb",
|
|
||||||
"bindings/rustboyadvance-jni",
|
|
||||||
]
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
serde = {version = "1.0.104", features = ["derive"] }
|
|
||||||
bincode = "1.2.1"
|
|
||||||
byteorder = "1"
|
|
||||||
num = "0.2.1"
|
|
||||||
num-traits = "0.2"
|
|
||||||
enum-primitive-derive = "^0.1"
|
|
||||||
bit = "^0.1"
|
|
||||||
colored = "1.9"
|
|
||||||
ansi_term = "0.12.1"
|
|
||||||
hexdump = "0.1.0"
|
|
||||||
time = "0.2.6"
|
|
||||||
bitfield = "0.13.1"
|
|
||||||
bitflags = "1.2.1"
|
|
||||||
zip = {version = "0.5.4", default-features = false, features = ["deflate", "time"]}
|
|
||||||
ctrlc = "3.1.3"
|
|
||||||
bit-set = "0.5.1"
|
|
||||||
debug_stub_derive = "0.3.0"
|
|
||||||
bytesize = "1.0.0"
|
|
||||||
memmem = "0.1.1"
|
|
||||||
log = "0.4.8"
|
|
||||||
arrayvec = "0.5.1"
|
|
||||||
|
|
||||||
rustyline = {version = "6.0.0", optional = true}
|
|
||||||
nom = {version = "5.0.0", optional = true}
|
|
||||||
gdbstub = { version = "0.1.2", optional = true, features = ["std"] }
|
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
bit = "^0.1"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
criterion = "0.3"
|
|
||||||
|
|
||||||
[[bench]]
|
|
||||||
name = "performance"
|
|
||||||
harness = false
|
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["arm7tdmi_dispatch_table"]
|
|
||||||
debugger = ["nom", "rustyline"]
|
|
||||||
gdb = ["gdbstub"]
|
|
||||||
# Uses lookup tables when executing instructions instead of `match` statements.
|
|
||||||
# Faster, but consumes more memory.
|
|
||||||
arm7tdmi_dispatch_table = []
|
|
||||||
|
|
||||||
[profile.dev]
|
|
||||||
opt-level = 0
|
|
||||||
debug = true
|
|
|
@ -10,7 +10,7 @@ publish = false
|
||||||
crate-type = ["staticlib", "cdylib"]
|
crate-type = ["staticlib", "cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rustboyadvance-ng = {path = "../../"}
|
rustboyadvance-core = {path = "../../rustboyadvance-core/"}
|
||||||
jni = { version = "0.14", default-features = false }
|
jni = { version = "0.14", default-features = false }
|
||||||
log = {version = "0.4.8", features = ["release_max_level_info", "max_level_debug"]}
|
log = {version = "0.4.8", features = ["release_max_level_info", "max_level_debug"]}
|
||||||
ringbuf = "0.2.1"
|
ringbuf = "0.2.1"
|
||||||
|
|
|
@ -22,8 +22,8 @@ use env_logger;
|
||||||
|
|
||||||
use ringbuf::{Consumer, Producer, RingBuffer};
|
use ringbuf::{Consumer, Producer, RingBuffer};
|
||||||
|
|
||||||
use rustboyadvance_ng::prelude::*;
|
use rustboyadvance_core::prelude::*;
|
||||||
use rustboyadvance_ng::StereoSample;
|
use rustboyadvance_core::StereoSample;
|
||||||
|
|
||||||
struct AudioRingBuffer {
|
struct AudioRingBuffer {
|
||||||
pub prod: Producer<i16>,
|
pub prod: Producer<i16>,
|
||||||
|
@ -190,7 +190,7 @@ pub mod bindings {
|
||||||
rom: jbyteArray,
|
rom: jbyteArray,
|
||||||
frame_buffer: jintArray,
|
frame_buffer: jintArray,
|
||||||
save_file: JString,
|
save_file: JString,
|
||||||
skip_bios: jboolean
|
skip_bios: jboolean,
|
||||||
) -> jlong {
|
) -> jlong {
|
||||||
match internal_open_context(&env, bios, rom, frame_buffer, save_file, skip_bios) {
|
match internal_open_context(&env, bios, rom, frame_buffer, save_file, skip_bios) {
|
||||||
Ok(ctx) => Box::into_raw(Box::new(Mutex::new(ctx))) as jlong,
|
Ok(ctx) => Box::into_raw(Box::new(Mutex::new(ctx))) as jlong,
|
||||||
|
|
|
@ -2,7 +2,7 @@ use jni::objects::*;
|
||||||
use jni::sys::*;
|
use jni::sys::*;
|
||||||
use jni::{JNIEnv, JavaVM};
|
use jni::{JNIEnv, JavaVM};
|
||||||
|
|
||||||
use rustboyadvance_ng::core::cartridge;
|
use rustboyadvance_core::core::cartridge;
|
||||||
|
|
||||||
fn parse_rom_header(env: &JNIEnv, barr: jbyteArray) -> cartridge::header::CartridgeHeader {
|
fn parse_rom_header(env: &JNIEnv, barr: jbyteArray) -> cartridge::header::CartridgeHeader {
|
||||||
let rom_data = env.convert_byte_array(barr).unwrap();
|
let rom_data = env.convert_byte_array(barr).unwrap();
|
||||||
|
@ -27,4 +27,4 @@ pub unsafe extern "C" fn Java_com_mrmichel_rustboyadvance_RomHelper_getGameTitle
|
||||||
) -> jstring {
|
) -> jstring {
|
||||||
let header = parse_rom_header(&env, rom_data);
|
let header = parse_rom_header(&env, rom_data);
|
||||||
env.new_string(header.game_title).unwrap().into_inner()
|
env.new_string(header.game_title).unwrap().into_inner()
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ authors = ["Michel Heily <michelheily@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rustboyadvance-ng = {path = "../../"}
|
rustboyadvance-core = {path = "../../rustboyadvance-core/"}
|
||||||
minifb = "0.11.2"
|
minifb = "0.11.2"
|
||||||
clap = {version = "2.33", features = ["color", "yaml"]}
|
clap = {version = "2.33", features = ["color", "yaml"]}
|
||||||
bit = "^0.1"
|
bit = "^0.1"
|
||||||
|
|
|
@ -9,9 +9,9 @@ extern crate clap;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate rustboyadvance_ng;
|
extern crate rustboyadvance_ng;
|
||||||
use rustboyadvance_ng::core::keypad;
|
use rustboyadvance_core::core::keypad;
|
||||||
use rustboyadvance_ng::prelude::*;
|
use rustboyadvance_core::prelude::*;
|
||||||
use rustboyadvance_ng::util::FpsCounter;
|
use rustboyadvance_core::util::FpsCounter;
|
||||||
|
|
||||||
use bit::BitIndex;
|
use bit::BitIndex;
|
||||||
use minifb;
|
use minifb;
|
||||||
|
|
|
@ -5,7 +5,7 @@ authors = ["Michel Heily <michelheily@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rustboyadvance-ng = {path = "../../"}
|
rustboyadvance-core = {path = "../../rustboyadvance-core/"}
|
||||||
sdl2 = {version = "0.33.0", features = ["image"]}
|
sdl2 = {version = "0.33.0", features = ["image"]}
|
||||||
ringbuf = "0.2.1"
|
ringbuf = "0.2.1"
|
||||||
bytesize = "1.0.0"
|
bytesize = "1.0.0"
|
||||||
|
@ -20,6 +20,6 @@ spin_sleep="0.3.7"
|
||||||
winres = "0.1"
|
winres = "0.1"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
debugger = ["rustboyadvance-ng/debugger"]
|
debugger = ["rustboyadvance-core/debugger"]
|
||||||
gdb = ["rustboyadvance-ng/gdb"]
|
gdb = ["rustboyadvance-core/gdb"]
|
||||||
arm7tdmi_dispatch_table = ["rustboyadvance-ng/arm7tdmi_dispatch_table"]
|
arm7tdmi_dispatch_table = ["rustboyadvance-core/arm7tdmi_dispatch_table"]
|
|
@ -1,7 +1,7 @@
|
||||||
use sdl2;
|
use sdl2;
|
||||||
use sdl2::audio::{AudioCallback, AudioDevice, AudioSpec, AudioSpecDesired};
|
use sdl2::audio::{AudioCallback, AudioDevice, AudioSpec, AudioSpecDesired};
|
||||||
|
|
||||||
use rustboyadvance_ng::{AudioInterface, StereoSample};
|
use rustboyadvance_core::{AudioInterface, StereoSample};
|
||||||
|
|
||||||
use ringbuf;
|
use ringbuf;
|
||||||
use ringbuf::{Consumer, Producer, RingBuffer};
|
use ringbuf::{Consumer, Producer, RingBuffer};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use sdl2::keyboard::Keycode;
|
use sdl2::keyboard::Keycode;
|
||||||
|
|
||||||
use rustboyadvance_ng::core::keypad as gba_keypad;
|
use rustboyadvance_core::core::keypad as gba_keypad;
|
||||||
use rustboyadvance_ng::InputInterface;
|
use rustboyadvance_core::InputInterface;
|
||||||
|
|
||||||
use bit;
|
use bit;
|
||||||
use bit::BitIndex;
|
use bit::BitIndex;
|
||||||
|
|
|
@ -35,10 +35,10 @@ use audio::create_audio_player;
|
||||||
use input::create_input;
|
use input::create_input;
|
||||||
use video::{create_video_interface, SCREEN_HEIGHT, SCREEN_WIDTH};
|
use video::{create_video_interface, SCREEN_HEIGHT, SCREEN_WIDTH};
|
||||||
|
|
||||||
use rustboyadvance_ng::core::cartridge::BackupType;
|
use rustboyadvance_core::core::cartridge::BackupType;
|
||||||
use rustboyadvance_ng::prelude::*;
|
use rustboyadvance_core::prelude::*;
|
||||||
use rustboyadvance_ng::util::spawn_and_run_gdb_server;
|
use rustboyadvance_core::util::spawn_and_run_gdb_server;
|
||||||
use rustboyadvance_ng::util::FpsCounter;
|
use rustboyadvance_core::util::FpsCounter;
|
||||||
|
|
||||||
const LOG_DIR: &str = ".logs";
|
const LOG_DIR: &str = ".logs";
|
||||||
const DEFAULT_GDB_SERVER_ADDR: &'static str = "localhost:1337";
|
const DEFAULT_GDB_SERVER_ADDR: &'static str = "localhost:1337";
|
||||||
|
|
|
@ -3,8 +3,8 @@ use sdl2::rect::Rect;
|
||||||
use sdl2::render::{Texture, TextureCreator, WindowCanvas};
|
use sdl2::render::{Texture, TextureCreator, WindowCanvas};
|
||||||
use sdl2::video::WindowContext;
|
use sdl2::video::WindowContext;
|
||||||
|
|
||||||
use rustboyadvance_ng::core::gpu::{DISPLAY_HEIGHT, DISPLAY_WIDTH};
|
use rustboyadvance_core::core::gpu::{DISPLAY_HEIGHT, DISPLAY_WIDTH};
|
||||||
use rustboyadvance_ng::VideoInterface;
|
use rustboyadvance_core::VideoInterface;
|
||||||
|
|
||||||
pub const SCREEN_WIDTH: u32 = DISPLAY_WIDTH as u32;
|
pub const SCREEN_WIDTH: u32 = DISPLAY_WIDTH as u32;
|
||||||
pub const SCREEN_HEIGHT: u32 = DISPLAY_HEIGHT as u32;
|
pub const SCREEN_HEIGHT: u32 = DISPLAY_HEIGHT as u32;
|
||||||
|
|
54
rustboyadvance-core/Cargo.toml
Normal file
54
rustboyadvance-core/Cargo.toml
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
[package]
|
||||||
|
name = "rustboyadvance-core"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Michel Heily <michelheily@gmail.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
serde = {version = "1.0.104", features = ["derive"] }
|
||||||
|
bincode = "1.2.1"
|
||||||
|
byteorder = "1"
|
||||||
|
num = "0.2.1"
|
||||||
|
num-traits = "0.2"
|
||||||
|
enum-primitive-derive = "^0.1"
|
||||||
|
bit = "^0.1"
|
||||||
|
colored = "1.9"
|
||||||
|
ansi_term = "0.12.1"
|
||||||
|
hexdump = "0.1.0"
|
||||||
|
time = "0.2.6"
|
||||||
|
bitfield = "0.13.1"
|
||||||
|
bitflags = "1.2.1"
|
||||||
|
zip = {version = "0.5.4", default-features = false, features = ["deflate", "time"]}
|
||||||
|
ctrlc = "3.1.3"
|
||||||
|
bit-set = "0.5.1"
|
||||||
|
debug_stub_derive = "0.3.0"
|
||||||
|
bytesize = "1.0.0"
|
||||||
|
memmem = "0.1.1"
|
||||||
|
log = "0.4.8"
|
||||||
|
arrayvec = "0.5.1"
|
||||||
|
|
||||||
|
rustyline = {version = "6.0.0", optional = true}
|
||||||
|
nom = {version = "5.0.0", optional = true}
|
||||||
|
gdbstub = { version = "0.1.2", optional = true, features = ["std"] }
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
bit = "^0.1"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
criterion = "0.3"
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "performance"
|
||||||
|
harness = false
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["arm7tdmi_dispatch_table"]
|
||||||
|
debugger = ["nom", "rustyline"]
|
||||||
|
gdb = ["gdbstub"]
|
||||||
|
# Uses lookup tables when executing instructions instead of `match` statements.
|
||||||
|
# Faster, but consumes more memory.
|
||||||
|
arm7tdmi_dispatch_table = []
|
||||||
|
|
||||||
|
[profile.dev]
|
||||||
|
opt-level = 0
|
||||||
|
debug = true
|
|
@ -276,7 +276,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_arm7tdmi_arm_eggvance() {
|
fn test_arm7tdmi_arm_eggvance() {
|
||||||
let mut gba = make_mock_gba(include_bytes!("../../external/gba-suite/arm/arm.gba"));
|
let mut gba = make_mock_gba(include_bytes!("../../../external/gba-suite/arm/arm.gba"));
|
||||||
|
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
gba.frame();
|
gba.frame();
|
||||||
|
@ -289,7 +289,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_arm7tdmi_thumb_eggvance() {
|
fn test_arm7tdmi_thumb_eggvance() {
|
||||||
let mut gba = make_mock_gba(include_bytes!("../../external/gba-suite/thumb/thumb.gba"));
|
let mut gba = make_mock_gba(include_bytes!("../../../external/gba-suite/thumb/thumb.gba"));
|
||||||
|
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
gba.frame();
|
gba.frame();
|
Reference in a new issue