mirror of
https://github.com/gopher64/gopher64.git
synced 2026-07-11 09:35:21 +02:00
Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fb756d5d94 | |||
| bdd15e340b | |||
| f9dbaeeb23 | |||
| d644617d62 | |||
| bbb0bd1447 | |||
| 711edef9cc | |||
| 64dae8970d | |||
| 4da7cd0551 | |||
| ce5ee30ef0 | |||
| 9eb4e73c4d | |||
| 3b1ef2938d | |||
| b8ce85b9fd | |||
| 49ba66f0a3 | |||
| 0bad5999c1 | |||
| 2911be7deb | |||
| 7ea1516d52 | |||
| 3bac21a908 | |||
| 182cb78649 | |||
| 42919d141a | |||
| 979c3666df | |||
| 4ff7a640d8 | |||
| 97928e1612 | |||
| 19354fe732 | |||
| febf321d58 | |||
| 1dcfe3a25d | |||
| 93aafafa75 | |||
| 44dd53b367 | |||
| 1ffa586789 | |||
| f12baef633 | |||
| 3e4efe110b | |||
| 981a8e8f05 | |||
| 13d6992ca1 | |||
| 5af1c1f7ee | |||
| 00c236ce8c | |||
| 034fa7c29c | |||
| ac30d7a6dd | |||
| e848789965 | |||
| 2f1a1b1479 | |||
| 52caa9cee3 |
+1
-7
@@ -1,8 +1,2 @@
|
||||
[target.x86_64-unknown-linux-gnu]
|
||||
[build]
|
||||
rustflags = ["-C", "target-cpu=x86-64-v3"]
|
||||
|
||||
[target.x86_64-pc-windows-msvc]
|
||||
rustflags = ["-C", "target-cpu=x86-64-v3"]
|
||||
|
||||
[target.x86_64-apple-darwin]
|
||||
rustflags = ["-C", "target-cpu=x86-64-v2"]
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
github: loganmc10
|
||||
patreon: loganmc10
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
run: |
|
||||
cargo build --release -v
|
||||
- name: Upload file
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: gopher64-linux
|
||||
path: target/release/gopher64
|
||||
@@ -44,13 +44,13 @@ jobs:
|
||||
run: |
|
||||
cargo build --release -v
|
||||
- name: Upload file
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: gopher64-windows
|
||||
path: target/release/gopher64.exe
|
||||
|
||||
build-macos:
|
||||
runs-on: macos-latest
|
||||
runs-on: macos-13
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -65,7 +65,7 @@ jobs:
|
||||
run: |
|
||||
cargo build --release -v
|
||||
- name: Upload file
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: gopher64-mac
|
||||
path: target/release/gopher64
|
||||
|
||||
+7
-7
@@ -1,28 +1,28 @@
|
||||
[package]
|
||||
name = "gopher64"
|
||||
version = "0.1.0"
|
||||
version = "0.1.7"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
dirs = "5.0"
|
||||
zip = "0.6"
|
||||
zip = "2.1"
|
||||
governor = "0.6"
|
||||
sevenz-rust = "0.5"
|
||||
sevenz-rust = "0.6"
|
||||
chrono = "0.4"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
eframe = "0.23"
|
||||
rfd = {version = "0.12", default-features = false, features = ["xdg-portal"] }
|
||||
eframe = "0.27"
|
||||
rfd = "0.14"
|
||||
sha2 = "0.10"
|
||||
rusttype = "0.9"
|
||||
futures = "0.3"
|
||||
sdl2-sys = { git = "https://github.com/Rust-SDL2/rust-sdl2.git" }
|
||||
sdl2-sys = "0.36"
|
||||
clap = { version = "4.4", features = ["derive"] }
|
||||
|
||||
[dependencies.sdl2]
|
||||
git = "https://github.com/Rust-SDL2/rust-sdl2.git"
|
||||
version = "0.36"
|
||||
default-features = false
|
||||
features = ["static-link","bundled"]
|
||||
|
||||
|
||||
@@ -56,4 +56,4 @@ Gopher64 is licensed under the GPLv3 license. Many portions of gopher64 have bee
|
||||
|
||||
## where to download
|
||||
|
||||
Builds can be found as artifacts on [GitHub Actions](https://github.com/gopher64/gopher64/actions?query=branch%3Amain)
|
||||
https://github.com/gopher64/gopher64/releases
|
||||
|
||||
@@ -37,6 +37,7 @@ fn main() {
|
||||
.file("parallel-rdp/parallel-rdp-standalone/util/aligned_alloc.cpp")
|
||||
.file("parallel-rdp/parallel-rdp-standalone/util/timer.cpp")
|
||||
.file("parallel-rdp/parallel-rdp-standalone/util/timeline_trace_file.cpp")
|
||||
.file("parallel-rdp/parallel-rdp-standalone/util/environment.cpp")
|
||||
.file("parallel-rdp/parallel-rdp-standalone/util/thread_name.cpp")
|
||||
.file("parallel-rdp/parallel-rdp-standalone/volk/volk.c")
|
||||
.file("parallel-rdp/interface.cpp")
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 79 KiB |
@@ -184,11 +184,15 @@ int sdl_event_filter(void *userdata, SDL_Event *event)
|
||||
{
|
||||
if (event->type == SDL_WINDOWEVENT)
|
||||
{
|
||||
SDL_WSIPlatform *platform = (SDL_WSIPlatform *)&wsi->get_platform();
|
||||
switch (event->window.event)
|
||||
{
|
||||
case SDL_WINDOWEVENT_CLOSE:
|
||||
emu_running = 0;
|
||||
break;
|
||||
case SDL_WINDOWEVENT_RESIZED:
|
||||
platform->do_resize();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Submodule parallel-rdp/parallel-rdp-standalone updated: 37bf2967e3...7e5ad30b8c
@@ -54,7 +54,17 @@ void SDL_WSIPlatform::poll_input()
|
||||
SDL_PumpEvents();
|
||||
}
|
||||
|
||||
void SDL_WSIPlatform::poll_input_async(Granite::InputTrackerHandler *handler)
|
||||
{
|
||||
SDL_PumpEvents();
|
||||
}
|
||||
|
||||
void SDL_WSIPlatform::set_window(SDL_Window *_window)
|
||||
{
|
||||
window = _window;
|
||||
}
|
||||
|
||||
void SDL_WSIPlatform::do_resize()
|
||||
{
|
||||
resize = true;
|
||||
}
|
||||
|
||||
@@ -13,9 +13,10 @@ public:
|
||||
uint32_t get_surface_height() override;
|
||||
bool alive(Vulkan::WSI &wsi) override;
|
||||
void poll_input() override;
|
||||
void poll_input_async(Granite::InputTrackerHandler *handler) override;
|
||||
void set_window(SDL_Window *_window);
|
||||
void do_resize();
|
||||
|
||||
private:
|
||||
VkSurfaceKHR surface;
|
||||
SDL_Window *window;
|
||||
};
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
[toolchain]
|
||||
channel = "nightly"
|
||||
+1
-1
@@ -247,7 +247,7 @@ impl Device {
|
||||
enabled: false,
|
||||
count: u64::MAX,
|
||||
handler: events::dummy_event,
|
||||
}; events::EventType::EventTypeCount as usize],
|
||||
}; events::EventType::Count as usize],
|
||||
next_event_count: u64::MAX,
|
||||
next_event: 0,
|
||||
},
|
||||
|
||||
+12
-7
@@ -80,14 +80,16 @@ pub fn dma_read(
|
||||
cart_addr &= CART_MASK as u32;
|
||||
|
||||
for i in 0..length {
|
||||
device.cart.rom[(cart_addr + i) as usize] =
|
||||
device.rdram.mem[(dram_addr + i) as usize ^ device.byte_swap];
|
||||
if cart_addr + i < device.cart.rom.len() as u32 {
|
||||
device.cart.rom[(cart_addr + i) as usize] =
|
||||
device.rdram.mem[(dram_addr + i) as usize ^ device.byte_swap];
|
||||
|
||||
device.ui.saves.romsave.0.insert(
|
||||
(cart_addr + i).to_string(),
|
||||
serde_json::to_value(device.rdram.mem[(dram_addr + i) as usize ^ device.byte_swap])
|
||||
.unwrap(),
|
||||
);
|
||||
device.ui.saves.romsave.0.insert(
|
||||
(cart_addr + i).to_string(),
|
||||
serde_json::to_value(device.rdram.mem[(dram_addr + i) as usize ^ device.byte_swap])
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
device.ui.saves.romsave.1 = true;
|
||||
@@ -127,6 +129,9 @@ pub fn init(device: &mut device::Device, rom_file: Vec<u8>) {
|
||||
device.ui.game_hash = calculate_hash(&device.cart.rom);
|
||||
|
||||
device.ui.game_id = String::from_utf8(device.cart.rom[0x3B..0x3E].to_vec()).unwrap();
|
||||
if device.ui.game_id.contains('\0') {
|
||||
device.ui.game_id = String::from("UNK");
|
||||
}
|
||||
}
|
||||
|
||||
pub fn load_rom_save(device: &mut device::Device) {
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ pub struct Cpu {
|
||||
pub instrs: [fn(&mut device::Device, u32); 64],
|
||||
pub special_instrs: [fn(&mut device::Device, u32); 64],
|
||||
pub regimm_instrs: [fn(&mut device::Device, u32); 32],
|
||||
pub events: [device::events::Event; device::events::EventType::EventTypeCount as usize],
|
||||
pub events: [device::events::Event; device::events::EventType::Count as usize],
|
||||
pub next_event_count: u64,
|
||||
pub next_event: usize,
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ pub enum EventType {
|
||||
InterruptCheck,
|
||||
SPDma,
|
||||
Compare,
|
||||
EventTypeCount,
|
||||
Count,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Copy, Clone)]
|
||||
|
||||
+351
-131
File diff suppressed because it is too large
Load Diff
+1
-3
@@ -1,5 +1,3 @@
|
||||
#![feature(round_ties_even)]
|
||||
#![feature(string_remove_matches)]
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
|
||||
mod device;
|
||||
@@ -122,7 +120,7 @@ fn main() {
|
||||
}
|
||||
} else {
|
||||
let options = eframe::NativeOptions {
|
||||
initial_window_size: Some(eframe::egui::vec2(640.0, 480.0)),
|
||||
viewport: eframe::egui::ViewportBuilder::default().with_inner_size([640.0, 480.0]),
|
||||
..Default::default()
|
||||
};
|
||||
eframe::run_native(
|
||||
|
||||
@@ -18,6 +18,7 @@ pub struct Ui {
|
||||
pub video_subsystem: Option<sdl2::VideoSubsystem>,
|
||||
pub audio_subsystem: Option<sdl2::AudioSubsystem>,
|
||||
pub joystick_subsystem: Option<sdl2::JoystickSubsystem>,
|
||||
#[allow(dead_code)]
|
||||
pub controller_subsystem: Option<sdl2::GameControllerSubsystem>,
|
||||
pub window: Option<sdl2::video::Window>,
|
||||
pub audio_device: Option<sdl2::audio::AudioQueue<i16>>,
|
||||
|
||||
+3
-1
@@ -115,7 +115,9 @@ impl eframe::App for GopherEguiApp {
|
||||
ui::input::configure_input_profile(&mut game_ui, profile_name);
|
||||
});
|
||||
self.configure_profile = false;
|
||||
if !self.profile_name.is_empty() && self.profile_name != "default" {
|
||||
if !self.profile_name.is_empty()
|
||||
&& !self.input_profiles.contains(&self.profile_name)
|
||||
{
|
||||
self.input_profiles.push(self.profile_name.clone())
|
||||
}
|
||||
};
|
||||
|
||||
+51
-17
@@ -87,28 +87,36 @@ pub fn set_axis_from_controller(
|
||||
let mut y = 0.0;
|
||||
if profile.controller_axis[AXIS_LEFT].0 {
|
||||
let axis_position =
|
||||
controller.axis(std::mem::transmute(profile.controller_axis[AXIS_LEFT].1));
|
||||
controller.axis(std::mem::transmute::<i32, sdl2::controller::Axis>(
|
||||
profile.controller_axis[AXIS_LEFT].1,
|
||||
));
|
||||
if axis_position as isize * profile.controller_axis[AXIS_LEFT].2 as isize > 0 {
|
||||
x = axis_position as f64 * MAX_AXIS_VALUE / i16::MAX as f64;
|
||||
}
|
||||
}
|
||||
if profile.controller_axis[AXIS_RIGHT].0 {
|
||||
let axis_position =
|
||||
controller.axis(std::mem::transmute(profile.controller_axis[AXIS_RIGHT].1));
|
||||
controller.axis(std::mem::transmute::<i32, sdl2::controller::Axis>(
|
||||
profile.controller_axis[AXIS_RIGHT].1,
|
||||
));
|
||||
if axis_position as isize * profile.controller_axis[AXIS_RIGHT].2 as isize > 0 {
|
||||
x = axis_position as f64 * MAX_AXIS_VALUE / i16::MAX as f64;
|
||||
}
|
||||
}
|
||||
if profile.controller_axis[AXIS_DOWN].0 {
|
||||
let axis_position =
|
||||
controller.axis(std::mem::transmute(profile.controller_axis[AXIS_DOWN].1));
|
||||
controller.axis(std::mem::transmute::<i32, sdl2::controller::Axis>(
|
||||
profile.controller_axis[AXIS_DOWN].1,
|
||||
));
|
||||
if axis_position as isize * profile.controller_axis[AXIS_DOWN].2 as isize > 0 {
|
||||
y = (axis_position as f64 * MAX_AXIS_VALUE / i16::MAX as f64).neg();
|
||||
}
|
||||
}
|
||||
if profile.controller_axis[AXIS_UP].0 {
|
||||
let axis_position =
|
||||
controller.axis(std::mem::transmute(profile.controller_axis[AXIS_UP].1));
|
||||
controller.axis(std::mem::transmute::<i32, sdl2::controller::Axis>(
|
||||
profile.controller_axis[AXIS_UP].1,
|
||||
));
|
||||
if axis_position as isize * profile.controller_axis[AXIS_UP].2 as isize > 0 {
|
||||
y = (axis_position as f64 * MAX_AXIS_VALUE / i16::MAX as f64).neg();
|
||||
}
|
||||
@@ -125,22 +133,34 @@ pub fn set_axis_from_keys(
|
||||
let mut x = 0.0;
|
||||
let mut y = 0.0;
|
||||
if profile.keys[AXIS_LEFT].0
|
||||
&& keyboard_state.is_scancode_pressed(std::mem::transmute(profile.keys[AXIS_LEFT].1))
|
||||
&& keyboard_state
|
||||
.is_scancode_pressed(std::mem::transmute::<i32, sdl2::keyboard::Scancode>(
|
||||
profile.keys[AXIS_LEFT].1,
|
||||
))
|
||||
{
|
||||
x = -MAX_AXIS_VALUE
|
||||
}
|
||||
if profile.keys[AXIS_RIGHT].0
|
||||
&& keyboard_state.is_scancode_pressed(std::mem::transmute(profile.keys[AXIS_RIGHT].1))
|
||||
&& keyboard_state
|
||||
.is_scancode_pressed(std::mem::transmute::<i32, sdl2::keyboard::Scancode>(
|
||||
profile.keys[AXIS_RIGHT].1,
|
||||
))
|
||||
{
|
||||
x = MAX_AXIS_VALUE
|
||||
}
|
||||
if profile.keys[AXIS_DOWN].0
|
||||
&& keyboard_state.is_scancode_pressed(std::mem::transmute(profile.keys[AXIS_DOWN].1))
|
||||
&& keyboard_state
|
||||
.is_scancode_pressed(std::mem::transmute::<i32, sdl2::keyboard::Scancode>(
|
||||
profile.keys[AXIS_DOWN].1,
|
||||
))
|
||||
{
|
||||
y = -MAX_AXIS_VALUE
|
||||
}
|
||||
if profile.keys[AXIS_UP].0
|
||||
&& keyboard_state.is_scancode_pressed(std::mem::transmute(profile.keys[AXIS_UP].1))
|
||||
&& keyboard_state
|
||||
.is_scancode_pressed(std::mem::transmute::<i32, sdl2::keyboard::Scancode>(
|
||||
profile.keys[AXIS_UP].1,
|
||||
))
|
||||
{
|
||||
y = MAX_AXIS_VALUE
|
||||
}
|
||||
@@ -162,7 +182,9 @@ pub fn set_buttons_from_joystick(
|
||||
let profile_joystick_hat = profile.joystick_hat[i];
|
||||
if profile_joystick_hat.0
|
||||
&& joystick.hat(profile_joystick_hat.1).unwrap()
|
||||
== unsafe { std::mem::transmute(profile_joystick_hat.2) }
|
||||
== unsafe {
|
||||
std::mem::transmute::<i8, sdl2::joystick::HatState>(profile_joystick_hat.2)
|
||||
}
|
||||
{
|
||||
*keys |= 1 << i;
|
||||
}
|
||||
@@ -187,15 +209,20 @@ pub fn set_buttons_from_controller(
|
||||
let profile_controller_button = profile.controller_buttons[i];
|
||||
if profile_controller_button.0 {
|
||||
unsafe {
|
||||
*keys |=
|
||||
(controller.button(std::mem::transmute(profile_controller_button.1)) as u32) << i;
|
||||
*keys |= (controller.button(std::mem::transmute::<i32, sdl2::controller::Button>(
|
||||
profile_controller_button.1,
|
||||
)) as u32)
|
||||
<< i;
|
||||
}
|
||||
}
|
||||
|
||||
let profile_controller_axis = profile.controller_axis[i];
|
||||
if profile_controller_axis.0 {
|
||||
let axis_position =
|
||||
unsafe { controller.axis(std::mem::transmute(profile_controller_axis.1)) };
|
||||
let axis_position = unsafe {
|
||||
controller.axis(std::mem::transmute::<i32, sdl2::controller::Axis>(
|
||||
profile_controller_axis.1,
|
||||
))
|
||||
};
|
||||
if axis_position as isize * profile_controller_axis.2 as isize > 0
|
||||
&& axis_position.saturating_abs() > i16::MAX / 2
|
||||
{
|
||||
@@ -219,8 +246,10 @@ pub fn get(ui: &mut ui::Ui, channel: usize) -> u32 {
|
||||
let profile_key = profile.keys[i];
|
||||
if profile_key.0 {
|
||||
unsafe {
|
||||
keys |= (keyboard_state.is_scancode_pressed(std::mem::transmute(profile_key.1))
|
||||
as u32)
|
||||
keys |= (keyboard_state
|
||||
.is_scancode_pressed(std::mem::transmute::<i32, sdl2::keyboard::Scancode>(
|
||||
profile_key.1,
|
||||
)) as u32)
|
||||
<< i;
|
||||
}
|
||||
}
|
||||
@@ -377,8 +406,13 @@ pub fn configure_input_profile(ui: &mut ui::Ui, profile: String) {
|
||||
key_set = true
|
||||
}
|
||||
sdl2::event::Event::JoyHatMotion { hat_idx, state, .. } => {
|
||||
new_joystick_hat[*value] =
|
||||
unsafe { (true, hat_idx as u32, std::mem::transmute(state)) };
|
||||
new_joystick_hat[*value] = unsafe {
|
||||
(
|
||||
true,
|
||||
hat_idx as u32,
|
||||
std::mem::transmute::<sdl2::joystick::HatState, i8>(state),
|
||||
)
|
||||
};
|
||||
key_set = true
|
||||
}
|
||||
sdl2::event::Event::JoyAxisMotion {
|
||||
|
||||
+5
-5
@@ -97,27 +97,27 @@ pub fn init(ui: &mut ui::Ui) {
|
||||
panic!("could not create save dir")
|
||||
}
|
||||
|
||||
ui.paths.eep_file_path = base_path.clone();
|
||||
ui.paths.eep_file_path.clone_from(&base_path);
|
||||
ui.paths
|
||||
.eep_file_path
|
||||
.push(ui.game_id.to_owned() + "-" + &ui.game_hash + ".eep");
|
||||
|
||||
ui.paths.sra_file_path = base_path.clone();
|
||||
ui.paths.sra_file_path.clone_from(&base_path);
|
||||
ui.paths
|
||||
.sra_file_path
|
||||
.push(ui.game_id.to_owned() + "-" + &ui.game_hash + ".sra");
|
||||
|
||||
ui.paths.fla_file_path = base_path.clone();
|
||||
ui.paths.fla_file_path.clone_from(&base_path);
|
||||
ui.paths
|
||||
.fla_file_path
|
||||
.push(ui.game_id.to_owned() + "-" + &ui.game_hash + ".fla");
|
||||
|
||||
ui.paths.pak_file_path = base_path.clone();
|
||||
ui.paths.pak_file_path.clone_from(&base_path);
|
||||
ui.paths
|
||||
.pak_file_path
|
||||
.push(ui.game_id.to_owned() + "-" + &ui.game_hash + ".mpk");
|
||||
|
||||
ui.paths.romsave_file_path = base_path.clone();
|
||||
ui.paths.romsave_file_path.clone_from(&base_path);
|
||||
ui.paths
|
||||
.romsave_file_path
|
||||
.push(ui.game_id.to_owned() + "-" + &ui.game_hash + ".romsave");
|
||||
|
||||
Reference in New Issue
Block a user