r/EmuDev

▲ 39 r/EmuDev

Finally my NES emulator on python can run some NES games after 5 days of fixing stuff. (~50 FPS)

I've found some insane optimization tricks that makes it possible for standard Python 3.11.9 to run NES CPU at PAL speed.

The project here: https://github.com/windowssandbox/NESemupy

I'll make more mappers and APU and fix PPU acting weird later. (It currently has NROM and ""broken"" MMC3 mappers)

Also can someone tell me why SMB2 crashes like that? because I've been trying to find a way to fix it but it won't go away. It must be a problem with how PRG rom is mapped for MMC3 ROMs or PRG bank switching for MMC3 ROMs is not working properly.

u/windowssandbox — 17 hours ago
▲ 10 r/EmuDev+2 crossposts

Bad Apple!! but it's running on my CHIP-8 emulator

Spent a fair bit of time working on this, and it's finally ready! The emulator is written in C and uses Raylib + had to implement a custom opcode to make the video playing part work.

The source is available on github and I've tried explaining it in the blogpost. Any feedback from low-level programmers people is highly appreciated!

(Also no audio in the video because I couldn't get it to sync to the demo because of some fps issue while encoding + copyright)

youtu.be
u/syswraith — 16 hours ago
▲ 17 r/EmuDev

The Simpsons Game Recomp Project

Progress Update: Recompilation of The Simpsons Game (2007)

Over the past few months, I have been working on a recompilation of The Simpsons Game (2007). It is now mostly complete, with just a few minor issues remaining.

I plan to release the source on GitHub soon and will create a follow-up post once it is live. If you would like a notification when it’s available, feel free to DM me. Please note that you will need an original Xbox 360 ISO of the game to patch your .xex file for an .exe or Linux setup.

I have plans for future modding support and an Android port once I resolve a final technical hurdle. I am hoping to push the initial builds later tonight.

* Current Status: Near-completion; the core recompilation logic is functional.

* Target Platforms: Windows (.exe) and Linux, with an Android port currently in the research phase.

* Requirements for End-Users: A valid, legally obtained Xbox 360 ISO of *The Simpsons Game* is required to extract and patch the `.xex` file.

* Roadmap:

* Phase 1: Public release of the source code on GitHub.

* Phase 2: Stabilization and bug fixes for the remaining minor technical issues.

* Phase 3: Implementation of external modding support and development of the Android build.

* Community Engagement: I am actively monitoring DMs for those interested in being notified the moment the repository goes live.

reddit.com
u/YesterMester — 17 hours ago
▲ 3 r/EmuDev

Advice for graphic api

I just wonder which api is more suitable for gameboy emulation project between directx and vulcan. I am pretty new when it comes to graphical programing. I only have an experience in backend development and some embedded system, so I literally have zero idea about graphic api. Btw my main development environment is visual studio and cmake in wsl.

reddit.com
u/stupid_computer_en — 21 hours ago
▲ 70 r/EmuDev

Fiz um emulador de NES usando C.

EN:
This has been, without a doubt, one of the most challenging projects I've ever worked on.

I spent countless nights debugging, fixing bugs, and trying to understand how the NES actually works. After a lot of effort, I finally reached a result I'm proud of... or almost.

Audio support is still missing, but I'll be implementing it little by little.

If anyone wants to check out the source code, test it, suggest improvements, report bugs, or even contribute to the project, any help is greatly appreciated!

Source code: https://github.com/Developer-Vini/NESEmu

PT:

Esse foi, sem dúvida, um dos projetos mais desafiadores que já fiz.

Passei noites e noites quebrando a cabeça, corrigindo bugs e tentando entender como o NES realmente funciona. Depois de muito esforço, finalmente cheguei a um resultado do qual me orgulho... ou quase.

Ainda falta implementar o áudio, mas vou fazendo isso aos poucos.

Se alguém quiser dar uma olhada no código-fonte, testar, sugerir melhorias, apontar bugs ou até mesmo contribuir com o projeto, toda ajuda é muito bem-vinda!

Código-fonte: https://github.com/Developer-Vini/NESEmu

u/Middle_Salt_6170 — 1 day ago
▲ 30 r/EmuDev+1 crossposts

Why does this trophy break my wii emulator so hard?

Hi all! I've been working on a wii emulator for 4 years now, and ran into some funny graphical issues / bugs on the way. Here's a fun story about one such bug that reveals a very clever rendering trick I saw in Mario Kart Wii!

youtube.com
▲ 135 r/EmuDev+3 crossposts

(PS1) SotN Recomp progress report!

What is a widescreen? a litle miserable 16:9 ??

Hello people, as you may not know ive been working on an SotN recomp (and the recompiler) for the past couple of months so ive come to share some updates!

so it turns out some people on the decomp server saw my tool and also started working on an recomp in parallel with different features, they thought i was using SotN more as a test ground to the recompiler (wich is partially true but i want to make a full recomp) so now both projects are going to merge, they have some cool features like cheats and i have some cool features like the widescreen as seen above lol

an "beta" release is aproaching very quickly, just know that it will be a bit buggy and the widescreen BREAKS a lot of stuff(ive been working on fix everything i can but i will probably forget some stuff) the game is playable start to finish with minor problems

now with an proper "team" it will be even more quick and it will have more features being worked on!
thanks for everyone support on this silly ptoject

shall the recomp age of ps1 begin!! muhahaha

(i relocated the item text wrongly i know)

other widescreen pic:

reddit.com
u/flafmg_ — 2 days ago
▲ 410 r/EmuDev+1 crossposts

Yamaha MA-3/MA-5 FM chip (SMAF ringtones): emulated from scratch in C++, no ROM dump

the ma-3 / ma-5 (ymu762 / ymu765) is the fm chip yamaha put in tons of early-2000s phones: nokia, sharp, samsung, panasonic. same family as the opl/opn chips behind adlib and the genesis, just smaller. it plays smaf ringtones (.mmf), and millions of these files are still floating around.

no datasheet ever came out. nothing public about how the synth actually works. so this got built purely from listening to real files and comparing.

a few things that turned out to matter:

early phones and later ones use two different formats for the same kind of song, with a different note offset. the only public reference gets that offset wrong by two octaves. copy it and every early tune plays too high.

the chip locks in each note's sound the moment it starts. some files change a channel's sound a few ticks late, while the note's already playing. handle that wrong and the start of the song sounds out of tune.

vibrato and how notes fade in and out aren't optional extras. skip them and it plays the right notes but sounds flat and dead.

some files also hide their drum sounds in a separate part of the file. miss that and the drums just don't play.

tested against a few hundred real ringtones. apache-2.0, c++, no dependencies, already running in an existing music player: FXChainPlayer.

repo: https://github.com/akustikrausch/yamaha-smaf-player

u/Dangerous-Section567 — 3 days ago
▲ 22 r/EmuDev+3 crossposts

Retro TV Emulator First .exe Build

this video is me testing my first .exe after completing most of my to do list. up to the point i cant go further until i really start testing stuff looking for bugs i wont find otherwise. Its coming along. its for the most part working and doing what i should. i see the occasional hiccup but none of it breaking anything. just a slight freeze or lag. still got stuff to add, still got stuff to fix but its something. its no longer an idea, its no longer a hope, its real.

u/RetroTVEmulator — 3 days ago
▲ 95 r/EmuDev

I was developing an NES emulator on Python, but Python is just too slow for NES CPU.

Yes you've heard the title AND watched the video.

You saw what was being printed in the logs.

I kept hearing people saying "Python is very fast, it will never be slow since it runs on your CPU's speed", oh but in this project, Python's speed is the problem.

The reason why it's the problem because when it's executing emulated 6502 assembly opcodes in emulated, it actually takes thousands of my CPU's cycles to execute a SINGLE opcode.

Your first response might be: "Just optimize the code to make it run faster". Yeah that might be helpful but the code is optimized to the maximum. I tried everything, and every optimization I could think of, it won't speed up.

Let me share you what my CPU actually is, it is Intel(R) Core(TM) i5-7500 CPU running clock speed at 3.40GHz to 3.75GHz (overclocked speed).

But the most frustrating about Python is that it is slower at emulating NES CPU than SNES does. If you've never seen an NES CPU being emulated inside SNES, then do google search "ACE super mario bros on super mario world" and see for yourself.

My guess is that Python's pre-compiled C code is truly unoptimized.

I'm not gonna continue until I figure out how to make it run NES CPU NTSC speed. Does anyone have ideas? Tell me. I've spent 2 days on this project.

Here is my github repo if you want to look at code I wrote: https://github.com/windowssandbox/NESemupy

I'm guessing that experienced C developers will understand Python code.

Edit: I did lookup table trick and it sped up to 16 FPS.

Edit 2: The profiler is right here: https://github.com/windowssandbox/NESemupy/blob/main/profiler.log (it updates overtime once i optimize the code)

Edit 3: I'll post when the emulator is finished, but right now I'm dealing with invisible CPU opcode bugs. (also it's now ~36 FPS)

Edit 4: It runs at ~57 FPS now, so no need to profile it.

u/windowssandbox — 6 days ago
▲ 9 r/EmuDev

JIT or LLVM

for jit compiler you have to write the whole compiler:
1- decoder

2- IR

2- register allocator

3- optimization like eliminate dead code

4- a whole arch backend like x86 or arm with register allocator and optimization again

for llvm just do this :

1- write decoder then for every instruction see what is the equivalent in llvm ir

llvm has it is own reg alloc + heavy optimization that emit incredibly fast code

reddit.com
u/Realistic_Extent3487 — 5 days ago
▲ 3 r/EmuDev

Bitset vs Array in C++

I'm making a chip8 emulator in C++ as my first emulator and wanted to know if it would be better to use bitset or an array to define flags, registers, and/or memory since most of the tutorials I find are in C and use what looks like arrays.

If there's any other info or resources you may know about making my first emulator, it would be much appreciated.

reddit.com
u/Which-Passenger-5956 — 5 days ago
▲ 2 r/EmuDev

Emulating the mini consoles

Is it possible to emulate the hardware and/or os/ui of the minis consoles like the nes, snes, sega genesis, ps1, and etc? (I don't mean the emulators that are on the consoles)(im talking the actual hardware and operating system)

reddit.com
u/HiFellowInternet — 7 days ago
▲ 6 r/EmuDev

Textorio Dev gameplay with P.logic (analog programing langauge)

Hey hey hey,

Wanted to show you my analog programming language in Textorio.

Worked well. :)

youtube.com
u/doncedonce — 7 days ago
▲ 5 r/EmuDev

I made some progress, but it's still broken (Master System).

https://preview.redd.it/2c533d2ha2ah1.png?width=1276&format=png&auto=webp&s=8cb1865b3b685e3505f0b5ea7d7ff28bf29b910c

https://preview.redd.it/wisi9fsja2ah1.png?width=1275&format=png&auto=webp&s=38b6179955db1e30ba76481fe08de0536800baf1

https://preview.redd.it/lsjao8i3b2ah1.png?width=1274&format=png&auto=webp&s=1af760551516eedc7534810a36af966af588fb23

https://preview.redd.it/3oz2qe6hb2ah1.png?width=731&format=png&auto=webp&s=37c409d5eb809471d567e4db2c166043300956dc

I'm developing a Sega Master System emulator, simply for the challenge of understanding how the console works, nothing serious. However, it has visible problems; the emulation is quite broken, the color palette is pinkish, and the sound is also broken, as you can see in the debug images I took to be sure of what I was doing. Do you have any ideas to shed some light on what's wrong? Color palette issues: In some games, the screen turns completely pink/magenta, or the color selection is completely inverted, even though the tiles themselves appear crisp and perfectly recognizable in my custom tile viewer. Background corruption: While Monica in the Dragon's Castle renders almost correctly (except for some sprite colors), Sonic The Hedgehog is completely distorted, looking like a huge scrolling or name table alignment problem. Audio issues: PSG's audio is extremely distorted or buzzing, even with the CPU running normally.

reddit.com
u/Prodgorigamia — 8 days ago