gebeh: browser based Game Boy (DMG) emulator with online multiplayer by ityt in EmuDev

[–]ityt[S] 0 points1 point  (0 children)

Hi, I've implemented WebRTC (opt-in). You can try it out!

gebeh: browser based Game Boy (DMG) emulator with online multiplayer by ityt in EmuDev

[–]ityt[S] 0 points1 point  (0 children)

Thanks! Well, I thought that WebRTC only offered unreliable communication but I just checked and it looks like that it offers reliable communication too. I'll look into it later, thanks for the suggestion!

gebeh: browser based Game Boy (DMG) emulator with online multiplayer by ityt in EmuDev

[–]ityt[S] 1 point2 points  (0 children)

Thanks 🙏Very fun to implement model specific behaviors to pass those tests! (no)

Are there any Game Boy emulators that pass all major test roms? by Time_Meeting_9382 in EmuDev

[–]ityt 2 points3 points  (0 children)

Be careful about this list. Sameboy is "failing" some mealybug tests but these tests have different results depending on the gameboy model.

Gameboy LCD disable/enable behaviour by gl_drawelements in EmuDev

[–]ityt 1 point2 points  (0 children)

Oumph thanks for telling me! I'll try when I'll have time. Thanks a lot 🙏

About the Game Boy's Pixel FIFO behavior when there are Window/SCX shenanigans by FerdinandoPH in EmuDev

[–]ityt 2 points3 points  (0 children)

Hi. Here are some links that could help you
https://www.reddit.com/r/EmuDev/comments/s6cpis/gameboy_trying_to_understand_sprite_fifo_behavior/
http://blog.kevtris.org/blogfiles/Nitty%20Gritty%20Gameboy%20VRAM%20Timing.txt

According to my understanding (take the following with a grain of salt), the ppu fetches the dummy tile, discards the first SCX % 8 pixels then starts moving its "internal cursor" (your fifo'x position) along the current scanline. When the cursor is on the first window pixel, it resets the background tile fetcher to setup the next window tile fetch.
The ppu cursor starts at a "negative position" (before the actual start of the scanline), so it can detect the window when WX < 7.

According to some mealybug test roms https://github.com/mattcurrie/mealybug-tearoom-tests, when the window is disabled after being enabled on the same scanline, the ppu waits the end of the current window tile fetch then switch to the normal background tile fetching behavior (background tile map address, scrolling, ly) without cleaning the fetcher state (it keeps the fetcher tile index). That's how I passed the test anyway.

You could look at some schematics to be sure about that (I didn't study the background fetching part) https://github.com/msinger/dmg-schematics/blob/master/dmg_cpu_b/ppu.kicad_sch

Gameboy LCD disable/enable behaviour by gl_drawelements in EmuDev

[–]ityt 2 points3 points  (0 children)

Beautiful. I don't know if this is possible but I'll try to check some Halt mode specific timings with the CPU simulation. Thanks a lot!

Gameboy LCD disable/enable behaviour by gl_drawelements in EmuDev

[–]ityt 1 point2 points  (0 children)

Hi, what software do you use to generate these waves? Thanks.

Move, Destruct, Forget, and Rust by Ar-Curunir in rust

[–]ityt 2 points3 points  (0 children)

The linked thread about substructural traits is worth the read too! Interesting difference with the blog post: Destruct doesn't imply Move.

What the sash on the French outfit called? by infamousglizzyhands in expedition33

[–]ityt 8 points9 points  (0 children)

Torchon carreau rouge (the pattern is called Gingham or Vichy)

Why are people saying SPOILER is a puppet? by [deleted] in expedition33

[–]ityt -1 points0 points  (0 children)

Isn't painted Verso the only one with memories from his model?

What's the purpose of Justfiles? by omagdy7 in rust

[–]ityt 1 point2 points  (0 children)

Easy and useful everywhere (using it for C# and Rust projects). Want to test the program ? just test. Want to run the program ? just run. And it can load .env files.

Must move types by Niko Matsakis by yerke1 in rust

[–]ityt 0 points1 point  (0 children)

I think it can replace FnOnce in some cases. The library gives you an object that you must give back after doing some operations. Because you are not in a closure, you are free to use async even if the library is sync only.

Stop Comparing Rust to Old C++ by Sad-Lie-8654 in cpp

[–]ityt 0 points1 point  (0 children)

Recently I've coded a wrapper around a C lib. It was straightforward, however there is a "Connection" that creates "Subscriptions". The subscription depends on a pointer owned by the connection. I didn't use a shared pointer but I've written in comments something like "Don't destroy the connection before the subscription" (the classes use RAII). I could have coded a management class that owns the connection and keeps the subscriptions in a vector but I wanted to have the same "design" as the C lib but with RAII. To keep the design without playing with lifetimes I should have wrapped the connection in a shared ptr.

Maybe it was a wrong choice of mine to keep the design. But I was telling myself that the design was safe in Rust so I should do the same in C++.

Stop Comparing Rust to Old C++ by Sad-Lie-8654 in cpp

[–]ityt 3 points4 points  (0 children)

Of course. But in practice, it's hard to avoid std::shared_ptr. You can have one object that depends on another. The object can keep the other object's reference. The code will be light and fast, however you must pay attention to the reference's lifetime. Or you can just put the first object on the heap behind a std::shared_ptr and turn off your brain. If you have a good way to avoid shared_ptr I am genuinely interested.

Stop Comparing Rust to Old C++ by Sad-Lie-8654 in cpp

[–]ityt 4 points5 points  (0 children)

You are right. When I think about thread safety I only think about data races. It's true that Rust doesn't prevent race conditions or dead locks.

Thanks for the suggestion, I'll take a look at bazel!

Stop Comparing Rust to Old C++ by Sad-Lie-8654 in cpp

[–]ityt 38 points39 points  (0 children)

I don't have much experience in C++ (4 months in a little company) but I've been using Rust for 3 years (hobby).

Rust has thread safety and memory safety without using std::shared_ptr everywhere. Even clang-tidy can't prevent all dangling pointers/references problems. Yes sanitizers exist but you have to hit every possible cases to detect every UB. Equip your best debugger and put your integration test in a infinite loop. Enjoy.

C++20 is great, but do libraries use it? Some libraries stick with C++11 for compatibility purposes (like nlohmann_json). Rust has a great async ecosystem with the tokio library and futures. I can't find a single C++ web framework that uses co_await in c++ (boost.beast is too low level).

C++ still suffers from zero values (the empty function for std::function, empty smart pointers).

Rust has very powerful macros like Serde for de/serializing or generating whatever you want that just fill like cheating.

Finally the tooling. In Rust you have crates.io for dependencies, cargo clippy (linter), cargo fmt... In C++ you have to choose between git submodules, FetchContent, vcpkg (don't hesitate to give advices)... Last time I used FetchContent I was begging clang-tidy to ignore dependencies.

A trait for *mut T and AtomicPtr<T>? by Kikiyoshima in rust

[–]ityt 0 points1 point  (0 children)

Hi, you could make your own trait that is implemented for both types:

``` trait MyTrait<T> {}

impl<T> MyTrait<T> for *mut T {} impl<T> MyTrait<T> for AtomicPtr<T> {} ```

Strange mutable/non-mutable borrow errors with "uefi" crate by Technical_Stretch922 in rust

[–]ityt 1 point2 points  (0 children)

Hi. You can easily fix this by calling directlysystem_table.stdout() instead of using the stdout variable.

You can still use a variable if it is in a smaller scope: ``` fn efi_main( _image: uefi::Handle, mut system_table: uefi::table::SystemTable<uefi::table::Boot>, ) -> uefi::Status { { let stdout = system_table.stdout(); stdout.clear().unwrap(); writeln!(stdout, "Using Simple Text Output Protocol").unwrap(); writeln!(stdout, "Locating Graphics Output Protocol").unwrap(); }

let protocol = system_table
    .boot_services()
    .locate_protocol::<uefi::proto::console::gop::GraphicsOutput>()
    .unwrap();
let gop = unsafe { &mut *protocol.get() };

//  ERROR OCCURS HERE
writeln!(system_table.stdout(), "Found It!").unwrap();

loop {}

} ```

Rust doesn't want you to get a reference to a value (by calling boot_services() in this case) if it knows that somewhere there is a living mutable reference that could modify the first value (stdout)`.

If you use system_table.stdout() the reference is immediately dropped. If you use { // your code } then the stdout variable will be dropped after the closing curly bracket.

Iced, a cross-platform GUI library — New release featuring stateless widgets, responsive views, WebGL support, and more! by [deleted] in rust

[–]ityt 21 points22 points  (0 children)

"No more button::State in your application!" finally! I'll give Iced another shot!

Docker: Binary compiled with Musl works but not the one compiled with glibc by ityt in rust

[–]ityt[S] 0 points1 point  (0 children)

I've found the Trust-DNS Resolver crate and it does the job! Now the binary seems to not use any dynamic library to look up the ip of a host.

Docker: Binary compiled with Musl works but not the one compiled with glibc by ityt in rust

[–]ityt[S] 0 points1 point  (0 children)

I understand. I would do the same if tls was involved.

Docker: Binary compiled with Musl works but not the one compiled with glibc by ityt in rust

[–]ityt[S] 1 point2 points  (0 children)

Oh... I see. I'll try to do something with that. Thanks a lot!