Beta NetopiaUE


Pickle

Mega GP Mania
Joined
May 30, 2006
Messages
5,518
Location
Detroit, Michigan
Website
Visit site
I started working on these emulator after finding it ran a patched game correctly.
Basically everything works, but it has one major issue, which im stuck on.

pnd: pickle.gp2x.de/pandora/nestopiaue.pnd
src: pickle.gp2x.de/pandora/nestopia_git.tar.gz

So the issue is with SDL2 and Framebuffer mode. I should have everything needed to force SDL2 to use GLES2. The screen will be black with any other driver other than the default. It seems the game wants to use X11 window no matter what.
Vsync isnt quite right with a box in the upper right. I recall the *.EMU had box issues. But i dont know if its the same thing.

Note: Im using my launcher but im trying to add some features like last selected item, and its bugged at the moment. Just move the selector around and it resets the right selected item.

I think this would be a nice emulator to add to the pandora library since nestopia is regarded as more accurate nes emulator.

So im posting this as a beta with the source that anyone else might take look over the source and see if missed something.
Ive been wondering if the call order of SDL2 api and opengl functions somehow is wrong.
 
Nice :) Also, let me know once the new features are in the launcher, I'd like to update my stuff then :)
 
The EX emu emulators have a touchscreen menu icon in the top right. I've assumed a misrendering of that is what causes the box issue - possibly it ends up being rendered but only after the scan has passed those lines, so what you actually see if a blank box there. Dunno if that helps any, sorry.
 
@Pickle : the issue in on my build of SDL2. I checked the dependancies and libGL is linked. So there is some linker fighting between libGL and libGLESv2. I'm trying to build a libSDL2 without that link (as it should link dynamicaly with libGL).

*EDIT*, mmm, there is more. I too only get a black screen. I have done a PVRTrace capture, and I see everything is drawing correctly. Strange...
 
Last edited:
Here my log from nestopia:
Code:
Setting PATH to /mnt/utmp/nestopiaue:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games
Setting LD_LIBRARY_PATH to /mnt/utmp/nestopiaue/lib:
Video Create
w: 800   h: 480
Window Flags: 1027
OpenGL: OpenGL ES 2.0 build 1.10@2359475
Database: 2901 items imported from internal DB
/mnt/utmp/nestopiaue/.nestopia/disksys.rom not found, Disk System games will not work.
Ines: 256k PRG-ROM set
Ines: 128k CHR-ROM set
Ines: battery set
Ines: horizontal mirroring set
Ines: NTSC set
Ines: mapper 4 set
Board: NES-TSROM
Board: 256k PRG-ROM
Board: 128k CHR-ROM
Board: 8k W-RAM
Board: MMC rev. B
Region: NTSC
Video Init
OpenGL Init
RenderSize w: 625   h: 480
Audio: SDL - 44100Hz 16-bit, 1 channel(s)
Port 1: Standard Pad
Port 2: Standard Pad

Emulation stopped
LIBGL: Initialising glshim
SDL: Forcing GLES2 driver
scancode = 0xa, i=2a key=0x67
0 joystick(s) found:
X11_GLES_LoadLibrary(0x7b28ab0, (null))
SDL_EGL_LoadLibrary(0x7b28ab0, (null), ...)
Starting PickleLauncher Version v0.23.
Running from '/mnt/utmp/nestopiaue/' as 'picklelauncher'
Loading config.
  from location config.txt
Loading ziplist.
Initializing SDL.
SDL initialized.
Loading profile.
Closing TTF fonts.
Quitting TTF.
Quitting SDL.
Quitting PickleLauncher Version v0.23.

i find it odd that these lines happen after i stop the emu:
Emulation stopped
LIBGL: Initialising glshim
SDL: Forcing GLES2 driver
 
I have spent a few hours on it and I'm still stuck. I don't understand what's wrong.
Here are 2 screenshots of PVRTrace, the nice tool that can do GL Capture. As you can see, on the 1st frame, the context creation looks fine. Compare to eglport, the WindowSurface is create before the Context, that's the only difference, but I doub it can have such dramatic change? nestopia_1stframe.jpg
If you look at the 90th frame, all looks ok and the emulated output shows the game screen (but the Pandora screen is still black).nestopia_90thframe.jpg
 
ptitseb is it only nestopia or is it also effecting your apps?

I looked over your trace and I dont see anything obvious, i wouldnt think the call order between context and windowsurface should have this effect.
the key part where the native window surface is null in the trace, so that good.
its like the X window somehow can now draw over the framebuffer.

Edit: the only thing i cant see is during the chooseconfig has EGL_OPENGL_ES2_BIT;

Code:
  ConfigAttribs[attrib++] = EGL_RENDERABLE_TYPE;  /* 17 */
#if defined(USE_GLES1)
  ConfigAttribs[attrib++] = EGL_OPENGL_ES_BIT;
#elif defined(USE_GLES2)
  ConfigAttribs[attrib++] = EGL_OPENGL_ES2_BIT;  /* 18 */
 
I just retried reicast, that has migrated to SDL2 lately (and is using GLES2 whith shader and all), and I have the picture showing correctly. Strange. I'll check how the init part is done.
 
Hi there.
I hame reviving that old thread @Pickle because I have finally understood what was wrong with nestopiaEU.
I have a working build on my side :D
nestopiaeu1.png

The issue was: the texture is npot (256x224). That should not be a problem in GLES2, as limited-npot is supported. But that is the trick, it's "limited npot". That means it's supported as long as you don't use mipmap and the wrap mode is clamp_to_edge (repeat and mirrored are not supported).
But here, the texture is not really setuped, so it's set to GL_NEAREST (that's fine) and GL_REPEAT (not fine).
Also, the texture was created at each frame, which doesn't sound nice.

So ogl_render() now looks like that;
Code:
@@ -177,30 +235,74 @@ void ogl_deinit() {
        if (gl_shader_prog) { glDeleteProgram(gl_shader_prog); }
        if (vshader) { glDeleteShader(vshader); }
        if (fshader) { glDeleteShader(fshader); }
+#if !defined(OPENGLES)
        if (vao) { glDeleteVertexArrays(1, &vao); }
+#endif
        if (vbo) { glDeleteBuffers(1, &vbo); }
+
+#if defined(PANDORA)
+        /* Pandora VSync */
+        if (fbdev != -1)
+            close( fbdev );
+        fbdev = -1;
+#endif
}


 void ogl_render() {
        // Render the scene
+       static int w = 0;
+       static int h = 0;
+       if(w!=basesize.w || h!=overscan_height) {
+       w = basesize.w;
+       h = overscan_height;
        glTexImage2D(GL_TEXTURE_2D,
                                0,
                                GL_RGBA,
-                               basesize.w,
-                               overscan_height,
+                               w/*basesize.w*/,
+                               h/*overscan_height*/,
                                0,
-                               GL_BGRA,
+                               GL_RGBA,
                                GL_UNSIGNED_BYTE,
                videobuf + overscan_offset);
+       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+       } else {
+        glTexSubImage2D(GL_TEXTURE_2D,
+                                0,
+                                0, 0,
+                                basesize.w,
+                                overscan_height,
+                                GL_RGBA,
+                                GL_UNSIGNED_BYTE,
+                videobuf + overscan_offset);
+       }

        glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
        glClear(GL_COLOR_BUFFER_BIT);
        glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 
Last edited:
thanks for not giving up on this, i wouldnt have thought it was would have been something that simple.
I will try this out myself and get the pnd together for release.

Is there a pnd you have with your latest SDL2 libs?
 
thanks for not giving up on this, i wouldnt have thought it was would have been something that simple.
I will try this out myself and get the pnd together for release.

Is there a pnd you have with your latest SDL2 libs?
Xash3D, Reicast or EternalLands use SDL2 and are not old.

Also, I have put my SDL2 sources there: https://github.com/ptitSeb/SDL2
 
Last edited:
Back
Top