Separated decl_static macro to it's own crate.
Rust crates are now built as `lib`s.
This commit is contained in:
parent
772f015752
commit
76d41b2359
10
rust/Cargo.lock
generated
10
rust/Cargo.lock
generated
@ -5,7 +5,17 @@ version = 3
|
||||
[[package]]
|
||||
name = "dw2003_exe_data"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dw2003_exe_digimon_profiles"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "util"
|
||||
version = "0.1.0"
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
[workspace]
|
||||
|
||||
members = ["dw2003_exe_data", "dw2003_exe_digimon_profiles"]
|
||||
members = ["dw2003_exe_data", "dw2003_exe_digimon_profiles", "util"]
|
||||
|
||||
@ -4,6 +4,8 @@ name = "dw2003_exe_data"
|
||||
version = "0.1.0"
|
||||
|
||||
[lib]
|
||||
crate-type = ["staticlib"]
|
||||
crate-type = ["lib"]
|
||||
|
||||
[dependencies]
|
||||
|
||||
util = { path = "../util" }
|
||||
|
||||
@ -1,14 +1,6 @@
|
||||
//! Data;
|
||||
|
||||
pub macro decl_static($section:literal, $($vis:vis static mut $NAME:ident: $T:ty = $value:expr; )*) {
|
||||
$(
|
||||
#[no_mangle]
|
||||
#[link_section = $section]
|
||||
$vis static mut $NAME: $T = $value;
|
||||
)*
|
||||
}
|
||||
|
||||
decl_static! { "dw2003_exe_data0",
|
||||
util::decl_static! { "dw2003_exe_data0",
|
||||
pub static mut D0x8003edcc: u32 = 0x0000020a;
|
||||
pub static mut D0x8003edd0: u32 = 0x00080001;
|
||||
pub static mut D0x8003edd4: u32 = 0x00000223;
|
||||
@ -111,7 +103,7 @@ decl_static! { "dw2003_exe_data0",
|
||||
pub static mut D0x8003ef58: u32 = 0x00000022;
|
||||
}
|
||||
|
||||
decl_static! { "dw2003_exe_data1",
|
||||
util::decl_static! { "dw2003_exe_data1",
|
||||
pub static mut D0x80040244: u32 = 0x0003000f;
|
||||
pub static mut D0x80040248: u32 = 0x00000001;
|
||||
pub static mut D0x8004024c: u32 = 0x000e0000;
|
||||
|
||||
@ -6,16 +6,3 @@
|
||||
|
||||
// Modules
|
||||
mod data;
|
||||
mod util;
|
||||
|
||||
// Dummy panic handler
|
||||
#[panic_handler]
|
||||
#[inline(never)]
|
||||
fn _panic_handler(_info: &core::panic::PanicInfo) -> ! {
|
||||
// SAFETY: This function will not make it to the final binary
|
||||
// due to our linker script discarding it and being
|
||||
// annotated with `inline(never)`
|
||||
unsafe {
|
||||
core::hint::unreachable_unchecked();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1 +0,0 @@
|
||||
//! Utilities
|
||||
@ -4,6 +4,8 @@ name = "dw2003_exe_digimon_profiles"
|
||||
version = "0.1.0"
|
||||
|
||||
[lib]
|
||||
crate-type = ["staticlib"]
|
||||
crate-type = ["lib"]
|
||||
|
||||
[dependencies]
|
||||
|
||||
util = { path = "../util" }
|
||||
|
||||
@ -2434,15 +2434,3 @@ pub static mut DIGIMON_PROFILES: [DigimonProfile; 55] = [
|
||||
unknown2: [0x1, 0x0],
|
||||
},
|
||||
];
|
||||
|
||||
// Dummy panic handler
|
||||
#[panic_handler]
|
||||
#[inline(never)]
|
||||
fn _panic_handler(_info: &core::panic::PanicInfo) -> ! {
|
||||
// SAFETY: This function will not make it to the final binary
|
||||
// due to our linker script discarding it and being
|
||||
// annotated with `inline(never)`
|
||||
unsafe {
|
||||
core::hint::unreachable_unchecked();
|
||||
}
|
||||
}
|
||||
|
||||
6
rust/util/Cargo.toml
Normal file
6
rust/util/Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
||||
[package]
|
||||
edition = "2021"
|
||||
name = "util"
|
||||
version = "0.1.0"
|
||||
|
||||
[dependencies]
|
||||
13
rust/util/src/lib.rs
Normal file
13
rust/util/src/lib.rs
Normal file
@ -0,0 +1,13 @@
|
||||
//! Utilities
|
||||
|
||||
// Features
|
||||
#![feature(decl_macro)]
|
||||
#![no_std]
|
||||
|
||||
pub macro decl_static($section:literal, $($vis:vis static mut $NAME:ident: $T:ty = $value:expr; )*) {
|
||||
$(
|
||||
#[no_mangle]
|
||||
#[link_section = $section]
|
||||
$vis static mut $NAME: $T = $value;
|
||||
)*
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user