binji / binjgb

Gameboy emulator implemented in C, that also runs in the browser
https://binji.github.io/binjgb/
MIT License
534 stars 61 forks source link

Browser Pre-Load Rom #22

Closed ChefFloyardee closed 4 years ago

ChefFloyardee commented 4 years ago

Hi! I want to use this to embed an emulator on my HTML page and have it pre-load a rom of my choice.

Could you guide me as to how to do this? Thanks!

ChefFloyardee commented 4 years ago

I tried downloading all of your files, uploading them to my git, and then trying to recreate your page (http://binji.github.io/binjgb/) thinking that if I had the source files it would work.

For some reason it is not working though. I just get a blank screen.

binji commented 4 years ago

Seems like that should be a good start, do you have the page up somewhere so I can see? Do you get any errors in the devtools console?

ChefFloyardee commented 4 years ago

Thank you so much for replying!

I finally figured out how to get it to load, but now I still need to figurfe out how to get it to pre-load my ROM and keep my current HTML.

Here are my links;

-This page is my current hosting page. I use a Flash Player to load my ROM. https://cheffloyardee.github.io/pokefloyd

-I want to replace that player with yours, but keep everything else. Here is my attempt at doing so https://github.com/ChefFloyardee/ChefFloyardee.github.io/blob/master/poke/floyd.html

Note that I renamed your "Demo" file to "Poke" to try and keep my "pokefloyd" url similar.

ChefFloyardee commented 4 years ago

I can get my page (https://cheffloyardee.github.io/poke/floyd) to look like yours (http://binji.github.io/binjgb/) and it will play my ROM.

But I want it to pre-load the ROM, and I want to keep the existing HTML title/picture that I had.

ChefFloyardee commented 4 years ago

As of my last commit on (https://cheffloyardee.github.io/poke/floyd) I removed your code in an attempt to first get my pages to match up with the original HTML, but for some reason my picture isn't even working.

ChefFloyardee commented 4 years ago

I really like your emulator by the way. It is much more crisp than my Flash one!

ChefFloyardee commented 4 years ago

I got the picture to work by adding it to the Poke aka Demo file!

Now I just need to figure out how to put in your emulator code and have it pre-load my ROM :D

ChefFloyardee commented 4 years ago

Any who, if I copy the source file from your page (http://binji.github.io/binjgb/) my page's current HTML is all messed up.

I also do not see where to link to a ROM to pre-load it.

ChefFloyardee commented 4 years ago

This is where I got the source file.

https://github.com/binji/binjgb/blob/master/demo/demo.html

ChefFloyardee commented 4 years ago

I am assuming my main issue is that I am copy and pasting the entire code, since I am unsure as to what to remove to get my desired result.

ChefFloyardee commented 4 years ago

So here is where I am currently at;

https://cheffloyardee.github.io/poke/floyd

I need to fix 3 glaring things; -First, how can I center the box? -Second, how can I set it to pre-load a ROM? -Third, how can I get an Icon Image in my tab, similar to yours (http://binji.github.io/binjgb/)?

Please let me know if you can help me out :D

ChefFloyardee commented 4 years ago

Here is my current code ;D

https://github.com/ChefFloyardee/ChefFloyardee.github.io/blob/master/poke/floyd.html

ChefFloyardee commented 4 years ago

Seems like that should be a good start, do you have the page up somewhere so I can see? Do you get any errors in the devtools console?

Hi there! I am so close to getting your Emulator on my Page in the state that I want it :D

I still am having trouble figuring out how to get it to pre-load a ROM file. Can you please help me with this?

Thanks in advance!

binji commented 4 years ago

I pushed a simpler version of the demo that should be easier to embed here:

https://github.com/binji/binjgb/blob/master/demo/simple.html https://github.com/binji/binjgb/blob/master/demo/simple.js

It loads a rom by default, and immediately starts playing. One problem is that audio doesn't work when you do this; a simple workaround is to pause/unpause (with the space bar).

Hope this helps!

ChefFloyardee commented 4 years ago

Thank you so much for replying! You have no idea how appreciative I am!

Do you have an HTML page that I can preview this at?

I see that you added a .html, .JS, and an example ROM to your folder.

I plan to do the same, but do I need to reference the ROM I want or does it automatically load?