-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
643 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
[submodule "acpica/acpica"] | ||
path = acpica/acpica | ||
url = https://github.com/acpica/acpica | ||
[submodule "userspace/doom/doomgeneric"] | ||
path = userspace/doom/doomgeneric | ||
url = https://github.com/rafalmiel/doomgeneric.git | ||
branch = cykusz |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pub const GFBINFO: usize = 0x3415; | ||
|
||
#[derive(Default)] | ||
pub struct FbInfo { | ||
pub width: u64, | ||
pub height: u64, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[workspace] | ||
resolver = "2" | ||
members = ["init", "shell", "mount", "umount", "syscall-user", "unixsockets", "testprogs", "playaudio", "sound-daemon"] | ||
members = ["doom", "init", "shell", "mount", "umount", "syscall-user", "unixsockets", "testprogs", "playaudio", "sound-daemon"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "doom" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
libc = "*" | ||
|
||
[dependencies.syscall-defs] | ||
path = "../../syscall-defs" | ||
|
||
[dependencies.syscall-user] | ||
path = "../syscall-user" | ||
|
||
[build-dependencies] | ||
cc = "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
let ref dg_src_dir = std::path::PathBuf::from("doomgeneric/doomgeneric"); | ||
let mut dg_c_paths = vec![]; | ||
let mut dg_h_paths = vec![]; | ||
|
||
// Find most c and h files | ||
for entry in std::fs::read_dir(dg_src_dir)? { | ||
let entry = entry?; | ||
if let Some(filename) = entry.file_name().to_str() { | ||
if filename.starts_with("doomgeneric_") | ||
|| filename == "i_main.c" | ||
|| filename.contains("sdl") | ||
|| filename.contains("allegro") | ||
{ | ||
continue; | ||
} | ||
|
||
if filename.ends_with(".h") { | ||
dg_h_paths.push(dg_src_dir.join(filename)); | ||
} else if filename.ends_with(".c") { | ||
dg_c_paths.push(dg_src_dir.join(filename)); | ||
} | ||
} | ||
} | ||
dg_c_paths | ||
.iter() | ||
.chain(dg_h_paths.iter()) | ||
.for_each(|path| println!("cargo:rerun-if-changed={}", path.to_str().unwrap())); | ||
|
||
cc::Build::new() | ||
.flag("-w") // Disable warnings | ||
.files(dg_c_paths) | ||
.compile("doomgeneric"); | ||
|
||
println!("cargo:rustc-link-lib=static=doomgeneric"); | ||
Ok(()) | ||
} |
Submodule doomgeneric
added at
6ba55e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
mod fb; | ||
mod input; | ||
|
||
use crate::DoomScreen; | ||
use std::process::ExitCode; | ||
|
||
pub struct CykuszDoom { | ||
fb: fb::Fb, | ||
input: input::Input, | ||
} | ||
|
||
impl CykuszDoom { | ||
pub fn new(doom_screen: DoomScreen) -> Result<CykuszDoom, ExitCode> { | ||
Ok(CykuszDoom { | ||
fb: fb::Fb::new(doom_screen)?, | ||
input: input::Input::new(), | ||
}) | ||
} | ||
|
||
pub fn get_ticks_ms(&self) -> u32 { | ||
((unsafe { syscall_user::syscall0(syscall_defs::SYS_TICKSNS).unwrap() }) / 1_000_000) as u32 | ||
} | ||
|
||
pub fn sleep_ms(&self, ms: u32) { | ||
syscall_user::sleep(ms as usize).unwrap(); | ||
} | ||
|
||
pub fn draw_frame(&mut self) { | ||
self.input.poll(); | ||
self.fb.flip(); | ||
} | ||
|
||
pub fn get_key(&mut self) -> Option<(bool, u8)> { | ||
self.input.get_key() | ||
} | ||
|
||
pub fn get_mouse(&mut self) -> Option<((bool, bool, bool), i32, i32)> { | ||
self.input.get_mouse() | ||
} | ||
|
||
pub fn quit(&self) { | ||
self.input.quit(); | ||
} | ||
} |
Oops, something went wrong.