reorganize files

This commit is contained in:
lif 2019-11-14 19:16:44 -08:00
parent b5b5a1041a
commit 6668c9c11f
8 changed files with 20 additions and 17 deletions

View File

@ -10,3 +10,4 @@ failure = "^0.1"
libloading = "^0.5"
num_enum = "^0.4"
structopt = "^0.3"

View File

@ -1,21 +1,14 @@
extern crate failure;
extern crate libloading;
#[allow(non_camel_case_types, non_upper_case_globals, non_snake_case, dead_code)]
mod libretro_ffi;
mod libretro_loading;
mod libretro_convert;
mod libretro_wrapper;
extern crate rustro;
use std::ffi::CStr;
use std::path::PathBuf;
use structopt::StructOpt;
use crate::libretro_convert::Handler;
use rustro::retro;
struct Foo;
impl Handler for Foo {
impl retro::convert::Handler for Foo {
fn video_refresh(&mut self, data: &[u8], width: u32, height: u32, pitch: u32) {
println!("video_refresh {}x{}", width, height);
}
@ -35,8 +28,8 @@ struct Opt {
fn main() -> failure::Fallible<()> {
let opt: Opt = Opt::from_args();
let lib = libloading::Library::new(&opt.core)?;
let retro = libretro_loading::LibretroApi::from_library(&lib)?;
let wrapper = libretro_wrapper::LibretroWrapper::from(retro);
let retro = retro::loading::LibretroApi::from_library(&lib)?;
let wrapper = retro::wrapper::LibretroWrapper::from(retro);
let mut foo = Foo{};
wrapper.register_handler(&mut foo);
println!("api version: {}", wrapper.as_ref().api_version());

4
src/lib.rs Normal file
View File

@ -0,0 +1,4 @@
extern crate failure;
extern crate libloading;
pub mod retro;

View File

@ -4,7 +4,7 @@ use std::path::PathBuf;
use num_enum::{TryFromPrimitive, IntoPrimitive};
use crate::libretro_ffi::*;
use super::ffi::*;
// NB: commented-out stuff is from newer versions of libretro.h not yet represented in libretro-sys

View File

@ -5,8 +5,8 @@ use std::path::Path;
use failure::Fallible;
use libloading;
use crate::libretro_ffi::*;
use crate::libretro_convert::*;
use super::ffi::*;
use super::convert::*;
pub struct LibretroApi<'a> {
lib: &'a libloading::Library, // for tying our lifetime to its own

5
src/retro/mod.rs Normal file
View File

@ -0,0 +1,5 @@
pub mod convert;
#[allow(non_camel_case_types, non_upper_case_globals, non_snake_case, dead_code)]
pub mod ffi;
pub mod loading;
pub mod wrapper;

View File

@ -9,8 +9,8 @@ use std::path::Path;
use libretro_sys::{Message, PixelFormat, SystemAvInfo, GameGeometry};
use num_enum::{IntoPrimitive, TryFromPrimitive};
use crate::libretro_convert::*;
use crate::libretro_loading::*;
use super::convert::*;
use super::loading::*;
static mut CB_SINGLETON: StaticCallbacks = StaticCallbacks {
handler: None,