Compare commits

...

59 Commits

Author SHA1 Message Date
Logan McNaughton 0eadc38917 fix out-of-bound access in sram (#95) 2024-12-23 11:20:09 +01:00
Logan McNaughton a40e795036 deal with out-of-bounds reads for RDRAM->RSP DMA (#94) 2024-12-23 10:15:30 +01:00
dependabot[bot] b70c943a43 Update eframe requirement from 0.29 to 0.30 (#93)
Updates the requirements on [eframe](https://github.com/emilk/egui) to permit the latest version.
- [Release notes](https://github.com/emilk/egui/releases)
- [Changelog](https://github.com/emilk/egui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/emilk/egui/compare/0.29.0...0.30.0)

---
updated-dependencies:
- dependency-name: eframe
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-17 06:52:15 +01:00
dependabot[bot] c962589478 Update governor requirement from 0.7 to 0.8 (#92)
Updates the requirements on [governor](https://github.com/boinkor-net/governor) to permit the latest version.
- [Release notes](https://github.com/boinkor-net/governor/releases)
- [Changelog](https://github.com/boinkor-net/governor/blob/master/release.toml)
- [Commits](https://github.com/boinkor-net/governor/compare/v0.7.0...v0.8.0)

---
updated-dependencies:
- dependency-name: governor
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-11 06:46:17 +01:00
Logan McNaughton 6dec154351 Bump to 0.1.11 (#91) 2024-11-10 23:01:50 +01:00
Logan McNaughton ca33797973 Update parallel-rdp (#90) 2024-11-10 22:53:53 +01:00
dependabot[bot] 8d331e1aed Update governor requirement from 0.6 to 0.7 (#88)
Updates the requirements on [governor](https://github.com/boinkor-net/governor) to permit the latest version.
- [Release notes](https://github.com/boinkor-net/governor/releases)
- [Changelog](https://github.com/boinkor-net/governor/blob/master/release.toml)
- [Commits](https://github.com/boinkor-net/governor/compare/v0.6.0...v0.7.0)

---
updated-dependencies:
- dependency-name: governor
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-22 05:07:08 +02:00
Logan McNaughton 5e7f562d0d update eframe to 0.29 (#87) 2024-10-18 21:22:51 +02:00
dependabot[bot] 14e3fe2a55 Update rfd requirement from 0.14 to 0.15 (#86)
Updates the requirements on [rfd](https://github.com/PolyMeilex/rfd) to permit the latest version.
- [Release notes](https://github.com/PolyMeilex/rfd/releases)
- [Changelog](https://github.com/PolyMeilex/rfd/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PolyMeilex/rfd/compare/0.14.0...0.15.0)

---
updated-dependencies:
- dependency-name: rfd
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-18 21:14:29 +02:00
Logan McNaughton b1c6dd2910 Add unsafe keyword for extern C (#83) 2024-10-17 20:35:39 +02:00
Logan McNaughton e87c4736ee Update parallel-rdp (#80) 2024-10-07 14:35:12 +02:00
Logan McNaughton e9e1e000c2 Bump to 0.1.10 (#79) 2024-09-02 20:07:27 +02:00
Logan McNaughton bc83dd26ee Update parallel-rdp (#78) 2024-09-02 19:57:47 +02:00
Logan McNaughton ae97990308 Add x86_64 build flag for parallel-rdp (#77)
* Add x86_64 build flag for parallel-rdp

* Fix flag

* Update build.rs
2024-08-28 12:35:52 +02:00
Logan McNaughton e02ac09703 Fix build target for optimizations (#76) 2024-08-25 23:01:52 +02:00
Logan McNaughton 4cbdae2fce Bump version to 0.1.9 (#75) 2024-08-25 17:58:42 +02:00
Logan McNaughton 877eff0fd4 update parallel rdp 2024-08-25 16:52:13 +02:00
Logan McNaughton b560944234 Update eframe to 0.28 (#74) 2024-07-04 22:19:05 +02:00
Logan McNaughton c6bfea5018 Update rust sdl2 to 0.37 (#72) 2024-06-14 01:35:46 -06:00
Logan McNaughton 74db103659 Bump to 0.1.8 (#69) 2024-06-13 14:48:29 -06:00
Logan McNaughton fb756d5d94 Update parallel rdp (#67) 2024-06-13 14:08:01 -06:00
Logan McNaughton bdd15e340b Add annotations suggested by linter (#68) 2024-06-13 14:04:32 -06:00
Logan McNaughton f9dbaeeb23 Update RDP (#66) 2024-06-04 07:51:23 -06:00
Logan McNaughton d644617d62 Fix some crashes with test rom (#64)
* Fix some crashes with test rom

* fix lint
2024-05-30 19:49:56 -06:00
Logan McNaughton bbb0bd1447 re-enable mac os build (#63)
* re-enable mac os build

* collapse
2024-05-29 07:26:24 -06:00
Logan McNaughton 711edef9cc update parallel rdp 2024-05-29 07:09:16 -06:00
Logan McNaughton 64dae8970d Bump ver to 0.1.7 (#62) 2024-05-27 13:35:34 -06:00
Logan McNaughton 4da7cd0551 Update parallel-rdp WSI integration (#61)
* Update parallel-rdp WSI integration

* fix build

* disable mac build
2024-05-27 13:23:56 -06:00
Logan McNaughton ce5ee30ef0 Update parallel rdp 2024-05-27 12:37:21 -06:00
dependabot[bot] 9eb4e73c4d Update zip requirement from 1.1 to 2.1 (#60)
Updates the requirements on [zip](https://github.com/zip-rs/zip2) to permit the latest version.
- [Release notes](https://github.com/zip-rs/zip2/releases)
- [Changelog](https://github.com/zip-rs/zip2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/zip-rs/zip2/compare/1.1.0...v2.1.0)

---
updated-dependencies:
- dependency-name: zip
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-26 20:54:48 -06:00
Logan McNaughton 3b1ef2938d Bump version to 0.1.6 (#57) 2024-05-24 11:49:22 -06:00
Logan McNaughton b8ce85b9fd update parallel rdp 2024-05-24 11:22:14 -06:00
Logan McNaughton 49ba66f0a3 Fix linter errors (#55) 2024-05-02 07:29:48 -06:00
dependabot[bot] 0bad5999c1 Update zip requirement from 0.6 to 1.1 (#53)
---
updated-dependencies:
- dependency-name: zip
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-21 20:44:19 -06:00
dependabot[bot] 2911be7deb Update sevenz-rust requirement from 0.5 to 0.6 (#52)
---
updated-dependencies:
- dependency-name: sevenz-rust
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-07 20:49:42 -06:00
dependabot[bot] 7ea1516d52 Update eframe requirement from 0.26 to 0.27 (#51)
Updates the requirements on [eframe](https://github.com/emilk/egui) to permit the latest version.
- [Release notes](https://github.com/emilk/egui/releases)
- [Changelog](https://github.com/emilk/egui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/emilk/egui/compare/0.26.0...0.27.0)

---
updated-dependencies:
- dependency-name: eframe
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-26 20:53:38 -06:00
Logan McNaughton 3bac21a908 bump version to 0.1.5 (#50) 2024-03-21 12:05:28 -06:00
Logan McNaughton 182cb78649 Use rust stable (#39) 2024-03-21 07:19:34 -06:00
Logan McNaughton 42919d141a clean up RFD features (#49) 2024-02-25 19:25:26 -07:00
dependabot[bot] 979c3666df Update rfd requirement from 0.13 to 0.14 (#48)
Updates the requirements on [rfd](https://github.com/PolyMeilex/rfd) to permit the latest version.
- [Release notes](https://github.com/PolyMeilex/rfd/releases)
- [Changelog](https://github.com/PolyMeilex/rfd/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PolyMeilex/rfd/compare/0.13.0...0.14.0)

---
updated-dependencies:
- dependency-name: rfd
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-25 19:18:51 -07:00
Logan McNaughton 4ff7a640d8 Update rust beta (#44) 2024-02-08 07:29:35 -07:00
dependabot[bot] 97928e1612 Update eframe requirement from 0.25 to 0.26 (#46)
Updates the requirements on [eframe](https://github.com/emilk/egui) to permit the latest version.
- [Release notes](https://github.com/emilk/egui/releases)
- [Changelog](https://github.com/emilk/egui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/emilk/egui/compare/0.25.0...0.26.0)

---
updated-dependencies:
- dependency-name: eframe
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-05 21:17:15 -07:00
Logan McNaughton 19354fe732 bump version to 0.1.4 (#41) 2024-01-28 12:42:20 -07:00
Logan McNaughton febf321d58 Update download link (#42) 2024-01-28 12:33:52 -07:00
Logan McNaughton 1dcfe3a25d Use sdl crate v0.36 (#40) 2024-01-28 12:11:56 -07:00
Logan McNaughton 93aafafa75 Remove string_remove_matches (#38) 2024-01-22 08:47:57 -07:00
Logan McNaughton 44dd53b367 round_ties_even is default now (#37) 2024-01-22 08:31:19 -07:00
Logan McNaughton 1ffa586789 bump version to 0.1.3 (#36) 2024-01-14 21:05:28 -07:00
Logan McNaughton f12baef633 Update rfd (#35) 2024-01-14 20:45:58 -07:00
dependabot[bot] 3e4efe110b Update eframe requirement from 0.24 to 0.25 (#33)
Updates the requirements on [eframe](https://github.com/emilk/egui) to permit the latest version.
- [Release notes](https://github.com/emilk/egui/releases)
- [Changelog](https://github.com/emilk/egui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/emilk/egui/compare/0.24.0...0.25.0)

---
updated-dependencies:
- dependency-name: eframe
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-08 19:36:18 -07:00
dependabot[bot] 981a8e8f05 Bump actions/upload-artifact from 3 to 4 (#32)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-14 19:56:37 -07:00
Logan McNaughton 13d6992ca1 bump ver to 0.1.2 2023-11-24 09:03:23 -07:00
Logan McNaughton 5af1c1f7ee Update eframe/egui (#29) 2023-11-24 09:03:01 -07:00
Logan McNaughton 00c236ce8c fix linter 2023-11-05 21:51:41 -07:00
Logan McNaughton 034fa7c29c fix window resize 2023-11-05 20:31:08 -07:00
Logan McNaughton ac30d7a6dd update ver to 0.1.1 2023-11-05 20:08:59 -07:00
Logan McNaughton e848789965 Create FUNDING.yml 2023-11-04 12:54:15 -06:00
Logan McNaughton 2f1a1b1479 fix small gui bug 2023-11-03 09:03:01 -06:00
Logan McNaughton 52caa9cee3 more 2023-11-02 12:44:49 -06:00
25 changed files with 487 additions and 203 deletions
+1 -7
View File
@@ -1,8 +1,2 @@
[target.x86_64-unknown-linux-gnu]
[target.'cfg(target_arch = "x86_64")']
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"]
+2
View File
@@ -0,0 +1,2 @@
github: loganmc10
patreon: loganmc10
+4 -4
View File
@@ -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
+8 -8
View File
@@ -1,28 +1,28 @@
[package]
name = "gopher64"
version = "0.1.0"
version = "0.1.11"
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"
governor = "0.6"
sevenz-rust = "0.5"
zip = "2.1"
governor = "0.8"
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.30"
rfd = "0.15"
sha2 = "0.10"
rusttype = "0.9"
futures = "0.3"
sdl2-sys = { git = "https://github.com/Rust-SDL2/rust-sdl2.git" }
sdl2-sys = "0.37"
clap = { version = "4.4", features = ["derive"] }
[dependencies.sdl2]
git = "https://github.com/Rust-SDL2/rust-sdl2.git"
version = "0.37"
default-features = false
features = ["static-link","bundled"]
+1 -1
View File
@@ -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
+9
View File
@@ -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")
@@ -50,6 +51,10 @@ fn main() {
#[cfg(target_os = "windows")]
{
#[cfg(target_arch = "x86_64")]
{
build.flag("/arch:AVX2");
}
build.flag("-DVK_USE_PLATFORM_WIN32_KHR");
winres::WindowsResource::new()
@@ -59,6 +64,10 @@ fn main() {
}
#[cfg(any(target_os = "linux", target_os = "macos"))]
{
#[cfg(target_arch = "x86_64")]
{
build.flag("-march=x86-64-v3");
}
build
.flag("-Wno-missing-field-initializers")
.flag("-Wno-unused-parameter");
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 79 KiB

+4
View File
@@ -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;
}
+10
View File
@@ -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;
}
+2 -1
View File
@@ -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;
};
-2
View File
@@ -1,2 +0,0 @@
[toolchain]
channel = "nightly"
+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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,
}
+1 -1
View File
@@ -11,7 +11,7 @@ pub enum EventType {
InterruptCheck,
SPDma,
Compare,
EventTypeCount,
Count,
}
#[derive(PartialEq, Copy, Clone)]
+8 -5
View File
@@ -165,11 +165,14 @@ pub fn do_dma(device: &mut device::Device, dma: RspDma) {
while j < count {
let mut i = 0;
while i < length {
let data = u32::from_ne_bytes(
device.rdram.mem[dram_addr as usize..dram_addr as usize + 4]
.try_into()
.unwrap(),
);
let mut data = 0;
if dram_addr < device::rdram::RDRAM_SIZE as u32 {
data = u32::from_ne_bytes(
device.rdram.mem[dram_addr as usize..dram_addr as usize + 4]
.try_into()
.unwrap(),
);
}
if offset != 0 {
// imem being updated
device.rsp.cpu.instructions[((mem_addr & 0xFFF) / 4) as usize].func =
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -141,7 +141,7 @@ pub fn dma_read_sram(
format_sram(device);
while i < dram_addr + length {
while i < dram_addr + length && i < device::rdram::RDRAM_SIZE as u32 {
device.ui.saves.sram.0[j as usize] = device.rdram.mem[i as usize ^ device.byte_swap];
i += 1;
j += 1;
@@ -191,7 +191,7 @@ pub fn dma_write_sram(
format_sram(device);
while i < dram_addr + length {
while i < dram_addr + length && i < device::rdram::RDRAM_SIZE as u32 {
device.rdram.mem[i as usize ^ device.byte_swap] = device.ui.saves.sram.0[j as usize];
i += 1;
j += 1;
+2 -4
View File
@@ -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,13 +120,13 @@ 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(
"gopher64",
options,
Box::new(|_cc| Box::new(ui::gui::GopherEguiApp::new())),
Box::new(|_cc| Ok(Box::new(ui::gui::GopherEguiApp::new()))),
)
.unwrap();
}
+1
View File
@@ -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>>,
+8 -4
View File
@@ -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())
}
};
@@ -127,7 +129,9 @@ impl eframe::App for GopherEguiApp {
}
egui::CentralPanel::default().show(ctx, |ui| {
ui.set_enabled(!self.configure_profile);
if self.configure_profile {
ui.disable()
}
if ui.button("Open ROM").clicked() {
// Spawn dialog on main thread
@@ -175,7 +179,7 @@ impl eframe::App for GopherEguiApp {
for i in 0..4 {
ui.label(format!("{}", i + 1));
egui::ComboBox::from_id_source(format!("profile-combo-{}", i))
egui::ComboBox::from_id_salt(format!("profile-combo-{}", i))
.selected_text(self.selected_profile[i].clone())
.show_ui(ui, |ui| {
for j in 0..self.input_profiles.len() {
@@ -192,7 +196,7 @@ impl eframe::App for GopherEguiApp {
} else {
self.controllers[self.selected_controller[i] as usize].clone()
};
egui::ComboBox::from_id_source(format!("controller-combo-{}", i))
egui::ComboBox::from_id_salt(format!("controller-combo-{}", i))
.selected_text(controller_text)
.show_ui(ui, |ui| {
ui.selectable_value(
+51 -17
View File
@@ -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
View File
@@ -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");
+1 -1
View File
@@ -1,6 +1,6 @@
use crate::ui;
extern "C" {
unsafe extern "C" {
pub fn vk_init(rdram_ptr: usize, rdram_size: u32, fullscreen: u8);
pub fn set_sdl_window(window: usize);
pub fn rdp_update_screen() -> u8;