Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAM not rendering at all #328

Open
qguv opened this issue Jul 2, 2020 · 3 comments
Open

OAM not rendering at all #328

qguv opened this issue Jul 2, 2020 · 3 comments
Assignees
Labels
bug Something isn't working Core/Wasm Issues concerning the core library of Wasmboy

Comments

@qguv
Copy link

qguv commented Jul 2, 2020

Hi all, this is such a cool project. I'm using it to show demos of gradual progress on a little cooking game I'm working on.

I haven't been able to get it to show any OAM entries though. Sprites simply won't draw. I could be missing some initialization that wasmboy expects, but the ROM runs correctly on hardware (DMG-01) and bgb (GB and GBC modes).

Here's a ROM, the corresponding source, and the embed page I'm using. Here's specifically where the LCD is first set up.

Thanks!

@torch2424 torch2424 self-assigned this Jul 4, 2020
@torch2424 torch2424 added bug Something isn't working Core/Wasm Issues concerning the core library of Wasmboy labels Jul 4, 2020
@torch2424
Copy link
Owner

Hello @qguv ! 😄 Thanks for the kind words about WasmBoy! And Undercooked looks super cool! 😄

I haven't been able to get it to show any OAM entries though. Sprites simply won't draw. I could be missing some initialization that wasmboy expects, but the ROM runs correctly on hardware (DMG-01) and bgb (GB and GBC modes).

Oh yeah that's quite odd! I took a look in the OAM viewer in my debugger and found that the OAM doesn't have your sprite in it 🤔

Screenshot from 2020-07-03 23-10-48

Though it does look like I'm interpreting the right LCDC:

Screenshot from 2020-07-03 23-15-06


Though keeping it real, I've been super busy lately, but working on WasmBoy has definitely been on my todo list. I've been working on a graphics rewrite which completely changes how I handles sprites so that might fix it :o That being said in the meantime, I don't have an estimate when I'll be able to fix that, I'd also reccomend trying binjgb: https://github.com/binji/binjgb It doesn't have a lot of easy embed options, but it's super accurate and also runs in the web 😄

Let me know if that helps! Thanks! 👍

@qguv
Copy link
Author

qguv commented Jul 4, 2020

Wow, thanks for your detailed response!

I went on a deep dive this weekend and discovered PPU modes—namely that I wasn't being careful enough to make sure I was only writing to OAM RAM at the appropriate times. I updated everything to only write there during vblank (mode 1) and the new version runs great on its embed page.

I guess it was only working on hardware and other emulators because of favorable timing or because those emulators aren't forbidding OAM RAM writes outright during PPU modes 2 and 3. So I suppose this is technically a bug, but not one likely to affect anything other than very very early drafts of homebrew ROMs.

@torch2424
Copy link
Owner

@qguv You are welcome! 😄

I went on a deep dive this weekend and discovered PPU modes—namely that I wasn't being careful enough to make sure I was only writing to OAM RAM at the appropriate times. I updated everything to only write there during vblank (mode 1) and the new version runs great on its embed page.

Ah yeah! So that's a tradeoff I had to make as an emudev 🙃 If I allow anything to be written at anytime, some games will have weird behavior, but then if do "the right thing" than my emulator has to be completely perfect (which in this case, it wasn't haha!)

But either way I'm glad you were able to figure it out! If you do plan to use WasmBoy going forward, I do feel it works like 9 / 10 of the time haha! The debugger is a good, easy place to figure out any weird behavior (either for the game, or the emulator itself). Especially while I haven't had as much time to dedicate to the project 😄

I guess it was only working on hardware and other emulators because of favorable timing or because those emulators aren't forbidding OAM RAM writes outright during PPU modes 2 and 3. So I suppose this is technically a bug, but not one likely to affect anything other than very very early drafts of homebrew ROMs.

Ah! So I am like 99% sure they do, but I think the timing on mine might be very slightly off or something. I'll probably take the time at some point to step through that version of your ROM with bgb and WasmBoy to figure out where I'm getting some weird behavior down the line 😄 👍

Let's keep this issue open as a TODO item to investigate / fix this for other early ROMs 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Core/Wasm Issues concerning the core library of Wasmboy
Projects
None yet
Development

No branches or pull requests

2 participants