GGVm: Port, Package, and Protect NES rom for PC, Mobile

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: GGVm: Port, Package, and Protect NES rom for PC, Mobile

Post by tepples »

Bregalad wrote:Interesting. I am however surprised by the lack of "features", i.e. have to require to game-specific hacks for raster timing and playing OGG files for audio. It sounds quite chep, there's probably some emulators with GNU licences allowing re-use without asking anyone for permission... or isn't there any ?!
There are plenty, such as FCEUX, Nintendulator, and Nestopia. It's just that most are copylefted, and copyleft requires distribution of complete corresponding source code for the emulator.
Sour wrote:There is so much information, even on the wiki (How many times have you read "FCEUX's code does this", "Nestopia's code does that" while reading the wiki?) that is extracted from the source of current GPL-licensed emulators
Mostly I've seen that in descriptions of obscure Japan-only mappers. (If an article that isn't about a Japan-only mapper uses "FCEUX's code does this", let me know and I'll evaluate it.) If a particular mapper implementation is the only GPL code in your project, and you remove that mapper from a branch of an emulator designed to support only a particular game that does not use that mapper, you no longer have to release your emulator under GPL. This means you can make a GPL version with all mappers and a permissive or LGPL version with few mappers, much as FFmpeg does with its configuration switches that enable use of GPL libraries.
Sour wrote:that it pretty much makes it impossible to not release an emulator as GPL (unless you just ignore the license's restrictions).
Copying an idea, process, or method of operation, as opposed to its expression, is not restricted by copyright. This means that if a particular piece of hardware is observed to do something, and the sequence and structure of your code is determined by that behavior, and you don't copy variable names or other "window dressing", it does not infringe.
Sour
Posts: 891
Joined: Sun Feb 07, 2016 6:16 pm

Re: GGVm: Port, Package, and Protect NES rom for PC, Mobile

Post by Sour »

tepples wrote:Mostly I've seen that in descriptions of obscure Japan-only mappers.
Yes, I was mostly referring to those as well - I should have been clearer.
tepples wrote:Copying an idea, process, or method of operation, as opposed to its expression, is not restricted by copyright. This means that if a particular piece of hardware is observed to do something, and the sequence and structure of your code is determined by that behavior, and you don't copy variable names or other "window dressing", it does not infringe.
Oh I see, I always interpreted "derived works" as being anything derived from the GPL code (be it code or knowledge). I'm clearly not a lawyer, though. Thanks for the information, I'll keep that in mind! Anyway, enough off-topic discussion from me :)
User avatar
YoukaiCountry
Posts: 29
Joined: Tue Mar 07, 2017 4:25 pm
Location: Ohio, USA
Contact:

Re: GGVm: Port, Package, and Protect NES rom for PC, Mobile

Post by YoukaiCountry »

I have the project all set up and building, however I believe there are some files missing from the assets. The Dushlan module is looking for font/gameover.png & font/gameover.fnt, however they seem to not be included. My local.properties seems to be in order, have I missed setting something up? I can always substitute them with my own, but I just want to make sure. Thanks!
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: GGVm: Port, Package, and Protect NES rom for PC, Mobile

Post by GradualGames »

I think I forgot something that was ignored for future check ins but is an integral part of the build. I'll fix it soon.
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: GGVm: Port, Package, and Protect NES rom for PC, Mobile

Post by GradualGames »

Fixed. Forgot to include android/assets, which is ignored because game assets are copied there (this directory is re-used by android and desktop projects) temporarily, but several files need to remain there (font, palette, shaders) etc.
User avatar
YoukaiCountry
Posts: 29
Joined: Tue Mar 07, 2017 4:25 pm
Location: Ohio, USA
Contact:

Re: GGVm: Port, Package, and Protect NES rom for PC, Mobile

Post by YoukaiCountry »

Works perfectly now.
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: GGVm: Port, Package, and Protect NES rom for PC, Mobile

Post by GradualGames »

Live CHR-RAM streaming is now supported. I added a test rom for demonstrating the capability. It works best on PC systems.
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: GGVm: Port, Package, and Protect NES rom for PC, Mobile

Post by GradualGames »

GradualGames wrote:
tepples wrote:Would it help to use a pixel shader for palette lookup so that you don't have to store eight copies of the pattern table in memory at once?
I actually do use a fragment shader to interpret the textures I'm generating, which does perform a palette lookup on a texture that is 32 pixels wide by 1 pixel tall. I actually encode the pixel value, attribute, and bg or spr in the rgb values of the actual textures. Without the shader turned on, everything looks sickly greenish/red/blue hues, haha.

I've been trying to think of a way to delegate all of the ppu decoding to the shader since that is performed in parallel on the gpu for each pixel (afaik), however the bandwidth needed for uploading 8k to the gpu every frame, though small, might be prohibitive? I'm not sure. #longtermgoals. It'd be neat if I could get that to work though, because then suddenly live CHR-RAM updates would be possible. Right now, I can only support it during transitions.
I was able to figure out how to delegate selection of background or sprite palettes as well as attributes entirely to the shader, so I do not have to duplicate textures anymore. This has the added benefit of making the new CHR-RAM streaming feature 4x faster.
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: GGVm: Port, Package, and Protect NES rom for PC, Mobile

Post by GradualGames »

iOS builds work now. .ogg files do not play back on iOS, so I will have to convert Dushlan's assets to .mp3, but I was able to test with one of my own games. Works very well, same smooth 60fps as PC. No tearing, no stuttering. *edit* this just in. These results are also true on an iPad 2nd gen. That's pretty good news ;)
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: GGVm: Port, Package, and Protect NES rom for PC, Mobile

Post by GradualGames »

Broke through yet another remaining performance issue on mobile devices. I had still been observing some stuttering, every few seconds, enough to interrupt gameplay, on my 1st gen Moto X. All gone! It's as smooth as I think is possible to achieve on Android at this point. I.e. I don't think I've played a single game on Android that achieves the smoothness possible on PC or iOS. Heck even John NES emulator does what I'm talking about (every few seconds, a frame is dropped). I'll update the demos and apk sometime soon.

*edit* Just noticed the CHR-RAM streaming test now runs at 60fps on Android. 7 chr tiles are uploaded each frame. I think that's the max you can do on NES itself, as when I try 8 I get glitches.

In addition, the stuck button issue on iOS is resolved.

Next things on my list:
-Make save states work on mobile devices
-Add menu to mobile devices
-Correct simulation of how PPU sorts background and foreground pixels. Right now certain effects are faked for common use cases.
-Improvement of touch controls on mobile so that they are a consistent size regardless of your screen size, as well as making them work for portrait orientation as well as landscape.
-Adding ability to skin the touch controls so you can have controls that fit the theme of your game.
-Continue to adapt more games to GGVm!
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: GGVm: Port, Package, and Protect NES rom for PC, Mobile

Post by tokumaru »

GradualGames wrote:7 chr tiles are uploaded each frame. I think that's the max you can do on NES itself, as when I try 8 I get glitches.
Well, that greatly depends on the type of loop you use to copy the bytes. With a fully unrolled loop and doing nothing else during vblank, you could easily update 16 tiles per frame. In my engine I believe I can do 12 tiles per frame if it's the graphics I have stored in immediate mode (LDA #$XX, STA $2007, which is only 6 cycles per byte).
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: GGVm: Port, Package, and Protect NES rom for PC, Mobile

Post by GradualGames »

tokumaru wrote:
GradualGames wrote:7 chr tiles are uploaded each frame. I think that's the max you can do on NES itself, as when I try 8 I get glitches.
Well, that greatly depends on the type of loop you use to copy the bytes. With a fully unrolled loop and doing nothing else during vblank, you could easily update 16 tiles per frame.

Cool...maybe I'll try unrolling the copy loop in the test, and then see how it fares. I'd love to be able to say it can support the max case for this ability.
In my engine I believe I can do 12 tiles per frame if it's the graphics I have stored in immediate mode (LDA #$XX, STA $2007, which is only 6 cycles per byte).
Whoa, you mean you actually have graphics stored as code? Neat.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: GGVm: Port, Package, and Protect NES rom for PC, Mobile

Post by tokumaru »

GradualGames wrote:Whoa, you mean you actually have graphics stored as code? Neat.
Heh, only for really critical stuff... This expands the graphics by a factor of 5 after all!
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: GGVm: Port, Package, and Protect NES rom for PC, Mobile

Post by tepples »

Popslide uses 8 cycles per byte plus I think 50 cycles per transfer of up to 64 bytes. This means you can fit an OAM DMA (526 cycles) and up to three 64-byte transfers (562 cycles each) totaling 12 tiles into an NTSC vblank (~2270 cycles). Then you can use the draw portion of the pre-render line (85 cycles) to set scroll position.
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: GGVm: Port, Package, and Protect NES rom for PC, Mobile

Post by GradualGames »

A bunch of bugs have been found and fixed. Additionally, the first split screen capability has been added (it uses Sprite 0 to determine where to do the split, but actual Sprite 0 status spinning continues to be unsupported, and never will be) via a special register on the cpu bus. Finally, GGVm is now more straightforward to use for audio. You don't need to code a complex sound adapter anymore, you can just write to a few simple registers on the cpu bus to play a song #, a sfx #, or pause/resume/stop the music. These new features are all documented on the github README.md under the section "Virtual Registers"
Post Reply