• 0 Votes
    9 Posts
    170 Views
    LolonoisL

    @mitu Well, if something worked incl. mouse orientation in the past (hdmi_rotate=..., config.txt) and then stops (rotate=..., cmdline.txt) working it is IMHO a regression as the foundation is still issuing the Rpi Kernel and firmware.

    Anyhow, using xrandr or wlrandr is not an option as I don't want to configure X/Wayland for SDL based emulators I have in use.

    It seems I have to table it at the Raspberry Pi forum.

  • 0 Votes
    1 Posts
    80 Views
    No one has replied
  • 0 Votes
    8 Posts
    837 Views
    mituM

    OK, the crash should be fixed in https://github.com/RetroPie/RetroPie-Setup/pull/3861.

    It doesn't matter how many un-configured devices are detected, one is enough to trigger the bug whenever its input is procesed by joy2key (a button needs to be pressed to trigger the bug).

  • Retrieve SDL2 joypad GUID in the shell?

    Help and Support
    3
    0 Votes
    3 Posts
    328 Views
    L

    @mitu

    great, many thanks!

  • Lock SDL2, MESA and DRM update

    Ideas and Development
    14
    0 Votes
    14 Posts
    896 Views
    F

    @gleam2003 said in Lock SDL2, MESA and DRM update:

    Install your Mesa and sdl2 library in /usr/local and config LD for use this before the one installed by RetroPie.
    In this way you can use original RetroPie script without lose your build library

    Thanks, I'll try

  • 1 Votes
    8 Posts
    804 Views
    N

    I decided to change the title to make it more relevant. I wasn't sure where to post the following yet as I was keen to share it in case this helps others.

    We ran into a very painful issue while testing a recent build of DOSBox Staging. The sound was crackling like hell in almost every games tested and only pi4 platform was affected (pi3 was ok). Builds for macOS, x86, etc didn't have the issue either. After a long and rather difficult debugging session the culprit has been found (thanks to @kcgen!) > SpeexDSP's floating-point API is unreliable on current (32-bit) Buster. After compiling our own version everything went back to normal.

  • 0 Votes
    6 Posts
    1k Views
    F

    For who is interested, I have build Mesa 22.0.1, SDL 2.0.20 and EmulationStation from source code on latest Raspberry Pi OS Lite and all work as expected (Full KMS and other stuff)

  • 0 Votes
    1 Posts
    255 Views
    No one has replied
  • Creating a custom SDL2 gamepad mapping?

    Help and Support
    8
    0 Votes
    8 Posts
    3k Views
    S

    @mitu said in Creating a custom SDL2 gamepad mapping?:

    Try maybe adding the export command to $HOME/.bashrc.

    That also worked from terminal but not from ES.

    So what I think is happening is this: autostart.sh is called from /etc/profile.d/10-retropie.sh which runs as part of /etc/profile. Then once that's complete it calls .profile and .bashrc.

    But since the environment var is set in autostart it is perhaps disconnected from the profile service and so maybe the variable is local only to that shell. So it works from inside ES but when I exit ES and the autostart shell terminates, the var goes away and it doesn't work from terminal.

    When I set it in .profile or in .bashrc it works from terminal, but these aren't processed until after ES exits because that's part of autostart which happens while /etc/profile is still going on.

  • 1 Votes
    5 Posts
    669 Views
    LolonoisL

    To clarify on backends.cfg: If it shows jzintv="dispmanx" the emulator call gets these environment variables passed in: SDL1_VIDEODRIVER=dispmanx SDL_DISPMANX_WIDTH=1600 SDL_DISPMANX_HEIGHT=1200 /opt/retropie/emulators/jzintv/bin/jzintv ... (but has no effect on the emulator), if it is absent or configured to SDL2 KMS in _Configurations/Tools _ (results in jzintv="default" in backends.cfg) no env variables are prefixed to the emulator call. So long story short: No need to explicitly set something in backends.cfg.

    On readline: You are right, if it is disabled in the build, a simplified implementation will be used. So I will leave libreadline-dev in the dependencies.

    Will file the two PRs shortly, will use $__archive_url.

    Thanks again.

  • Raspberry Pi 4 - Forced VSYNC?!

    Help and Support
    14
    0 Votes
    14 Posts
    3k Views
    F

    @mitu Built SDL 2.0.14 with

    --disable-video-rpi --enable-video-kmsdrm

    The FPS problem still exists with 5.4 kernel, or newer one after full SO upgrade (in this case with fkms or kms), and in this way when emulator is closed EmulationStation is frozen.

    Anyway I found a solution, if VERTICAL SYNC is enabled also on emulator (I added a command line parameter for this) also Raspberry Pi v4 version is ok.

    If you don't have any other idea I'll stop the investigation, I don't love VSYNC because if a user has a 50 Hz monitor all games with nominal 60 FPS framerate runs at 50 FPS.

    Really appreciate your help

  • 0 Votes
    13 Posts
    3k Views
    mituM

    @TheFloW said in Randomly slow EmulationStation menus on RPi 4:

    I was referring to how to get to HDMI boost and TV mode

    HDMI boot configuration is not available for the Pi4, as for the mode selection, you can just use raspi-config and select 1080p as default video mode.

  • 0 Votes
    13 Posts
    802 Views
    BuZzB

    @Styleshift said in Key You Just Pressed Is Not Recoqnised By SDL Endev Key Code NUMBER 305/544 After update 4.5.2 to 4.5.8:

    I also chipped a tooth today.

    Can it run homebrew now? ;-)

    Thanks for the kind remarks. (Hope your tooth is fixed up soon - not fun !).

  • 0 Votes
    15 Posts
    805 Views
    mituM

    @Styleshift Please open a new topic and add the info from https://retropie.org.uk/forum/topic/3/read-this-first. You shouldn't get the error in the topic unless you've manually downgraded the libsdl2(-dev) package.

  • 0 Votes
    2 Posts
    401 Views
    T
    sudo apt-get install ubuntu-desktop

    Resolved the issue, and PS2 appears in the EmulationStation frontend.
    .bash_history doesn't show any evidence of the desktop environment being removed - by way of shell command.

  • 0 Votes
    15 Posts
    8k Views
    mituM

    @jgraves We don't support running from a desktop environment, if you want to test the new PI4 support, start from a Buster Lite installation and do a manual installation - the latest version has integrated the fkms_rpi4 development branch.

    MODERATION note: I'm going to lock this topic, it's no longer relevant to the current RetroPie version and creates more confusion than it gives solutions.

  • 0 Votes
    3 Posts
    1k Views
    Z

    Thanks, the incorrect library was the main issue with this program! Another few things I noticed while experimenting with this code snippet:

    apparently Vertex Arrays don't work with GLESv2 (stackoverflow), so you have to use Vertex Buffers errors in vertex/fragment shader are only detected when linking the program, not on compilation when using opengl extensions (e.g. GL_OES_mapbuffer, see Raspberry Pi Video Core API for available extensions) you have to put#define GL_GLEXT_PROTOTYPES before including SDL2/SDL_opengles2.h and additionally link with -lbrcmEGL in order to get the functions if you don't call SDL_Quit() before exiting your program, the raspberry pi's console will be blocked (it seems like the input focus is still on the SDL window otherwise)

    I updated the code with a few more comments and fixed some stuff:
    main.c:

    #include <SDL2/SDL.h> #include <SDL2/SDL_opengles2.h> #define FULLSCREEN 1 #define TRIANGLE_SIZE 0.9f #define INFO_LOG_BUFFER_SIZE 1024 // Shader sources const GLchar* vertexSource = "attribute vec2 position;\n" "attribute vec4 color;\n" "varying vec4 out_color;\n" "uniform mat4 proj_mat;\n" "uniform mat4 model_mat;\n" "void main()\n" "{\n" " gl_Position = proj_mat*model_mat*vec4(position, 0, 1.0);\n" " out_color = color;\n" "}\n"; const GLchar* fragmentSource = "varying vec4 out_color;\n" "void main()\n" "{\n" " gl_FragColor = out_color;\n" "}\n"; // struct representing a colored 2D vertex typedef struct{ float x; float y; float r; float g; float b; float a; }Vertex; // adjusting viewport and projection matrix to fit current window dimensions void resize(int w, int h, GLint proj_mat_location); // create rotation matrix (z axis) and upload to shader at given uniform location void setRotationMatrix(float rad, GLint model_mat_location); // create orthogonal matrix and upload to shader at given uniform location void setOrthoMatrix(float left, float right, float bottom, float top, float n, float f, GLint proj_mat_location); int main() { // initialize SDL printf("Initializing SDL...\n"); if (SDL_Init(SDL_INIT_VIDEO) < 0) { printf("ERROR: Failed to initialize SDL: %s\n", SDL_GetError()); return 1; } // setting SDL flags unsigned int sdl_flags = SDL_WINDOW_OPENGL; SDL_DisplayMode current; current.w = 800; current.h = 600; if(FULLSCREEN){ sdl_flags |= SDL_WINDOW_FULLSCREEN; // getting current display-resolution if (SDL_GetDesktopDisplayMode(0, &current) != 0){ printf("Could not retrieve current display resolution: %s\n", SDL_GetError()); } }else{ sdl_flags |= SDL_WINDOW_RESIZABLE; } const char * fullscreen_string = FULLSCREEN ? "(fullscreen)" : ""; printf("Creating window %dx%d%s...\n", current.w, current.h, fullscreen_string); SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); // use GLESv2 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); // activate V-Sync SDL_GL_SetSwapInterval(1); SDL_Window * window = SDL_CreateWindow("Hello GLES!", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, current.w, current.h, sdl_flags); if(window == NULL) { printf("Error while creating window: %s\n", SDL_GetError()); SDL_Quit(); return 1; } // create gl context printf("Creating OpenGL context...\n"); SDL_GLContext context = SDL_GL_CreateContext(window); if(context == NULL) { printf("Error while creating OpenGL Context: %s\n", SDL_GetError()); SDL_DestroyWindow(window); SDL_Quit(); return 1; } // hide mouse cursor SDL_ShowCursor(0); // set gl parameters glClearColor(1.f, 1.f, 1.f, 1.f); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDisable(GL_DEPTH_TEST); glDisable(GL_CULL_FACE); // create RGB-triangle data and copy to vertex buffer GLuint vbo; glGenBuffers(1, &vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo); Vertex vertices[3]; for(int i = 0; i < 3; i++){ vertices[i].x = cos(i*(2*M_PI/3.0f))*TRIANGLE_SIZE; vertices[i].y = sin(i*(2*M_PI/3.0f))*TRIANGLE_SIZE; vertices[i].r = 0.0f; vertices[i].g = 0.0f; vertices[i].b = 0.0f; vertices[i].a = 1.0f; } vertices[0].r = 1.0f; vertices[1].g = 1.0f; vertices[2].b = 1.0f; glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); printf("Compiling Shader...\n"); // compile the vertex shader GLuint vertexShader = glCreateShader(GL_VERTEX_SHADER); glShaderSource(vertexShader, 1, &vertexSource, NULL); glCompileShader(vertexShader); // compile the fragment shader GLuint fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(fragmentShader, 1, &fragmentSource, NULL); glCompileShader(fragmentShader); // link vertex and fragment shader into shader program GLuint shader_program = glCreateProgram(); glAttachShader(shader_program, vertexShader); glAttachShader(shader_program, fragmentShader); glLinkProgram(shader_program); // program info log char info_log_buffer[INFO_LOG_BUFFER_SIZE]; info_log_buffer[0] = '\0'; glGetProgramInfoLog(shader_program, INFO_LOG_BUFFER_SIZE, 0, info_log_buffer); if(info_log_buffer[0] != '\0') printf("Shader-Program-Info:\n%s\n", info_log_buffer); // linking successfull? int status; glGetProgramiv(shader_program, GL_LINK_STATUS, &status); if(status == GL_FALSE){ SDL_GL_DeleteContext(context); SDL_DestroyWindow(window); SDL_Quit(); return 1; } // use custom shader glUseProgram(shader_program); // feed vertex attributes with triangle-data // position GLint posAttrib = glGetAttribLocation(shader_program, "position"); glEnableVertexAttribArray(posAttrib); glVertexAttribPointer(posAttrib, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0); // color GLint colorAttrib = glGetAttribLocation(shader_program, "color"); glEnableVertexAttribArray(colorAttrib); glVertexAttribPointer(colorAttrib, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)(2*sizeof(float))); // retrieve uniform locations GLint proj_mat_location = glGetUniformLocation(shader_program, "proj_mat"); GLint model_mat_location = glGetUniformLocation(shader_program, "model_mat"); // inital resize to set viewport and projection mastrix resize(current.w, current.h, proj_mat_location); // run main loop printf("Rendering triangle...\n"); while(1){ int quit = 0; SDL_Event e; while(SDL_PollEvent(&e)){ if(e.type == SDL_QUIT || e.type == SDL_KEYDOWN) quit = 1; else if(e.type == SDL_WINDOWEVENT && e.window.event == SDL_WINDOWEVENT_RESIZED) resize(e.window.data1, e.window.data2, proj_mat_location); } if(quit){ printf("Program was quit by user!\n"); break; } glClearColor(1,1,1,1); glClear(GL_COLOR_BUFFER_BIT); setRotationMatrix(SDL_GetTicks()/1000.f * M_PI/2.f, model_mat_location); glDrawArrays(GL_TRIANGLES, 0, 3); SDL_GL_SwapWindow(window); } // clean up SDL_GL_DeleteContext(context); SDL_DestroyWindow(window); SDL_Quit(); return 0; } void setRotationMatrix(float rad, GLint model_mat_location) { // rotation around z axis float sin_angle = sin(rad); float cos_angle = cos(rad); float mat[16]; mat[0] = cos_angle; mat[1] = sin_angle; mat[2] = 0; mat[3] = 0; mat[4] = -sin_angle; mat[5] = cos_angle; mat[6] = 0; mat[7] = 0; mat[8] = 0; mat[9] = 0; mat[10] = 1; mat[11] = 0; mat[12] = 0; mat[13] = 0; mat[14] = 0; mat[15] = 1; glUniformMatrix4fv(model_mat_location, 1, GL_FALSE, mat); } void resize(int w, int h, GLint proj_mat_location) { glViewport(0, 0, w, h); // set orthogonal view so that coordinates [-1, 1] area always visible and proportional on x and y axis if(w > h){ float f = w/(float)h; setOrthoMatrix(-f, f, -1, 1, -1, 1, proj_mat_location); }else{ float f = h/(float)w; setOrthoMatrix(-1, 1, -f, f, -1, 1, proj_mat_location); } } void setOrthoMatrix(float left, float right, float bottom, float top, float n, float f, GLint proj_mat_location) { // set orthogonal matrix float mat[16]; mat[0] = 2.0f/(right-left); mat[1] = 0.f; mat[2] = 0.f; mat[3] = 0.f; mat[4] = 0.f; mat[5] = 2.0f/(top-bottom); mat[6] = 0.f; mat[7] = 0.f; mat[8] = 0.f; mat[9] = 0.f; mat[10] =-2.f/(f-n); mat[11] = 0.f; mat[12] =-(right+left)/(right-left); mat[13] =-(top+bottom)/(top-bottom); mat[14] =-(f+n)/(f-n); mat[15] = 1.f; glUniformMatrix4fv(proj_mat_location, 1, GL_FALSE, mat); }

    Compiles and runs on Raspberry Pi 3:

    gcc main.c -o gles_test -lSDL2 -lSDL2main -L/opt/vc/lib -lbrcmGLESv2 -lm ./gles_test

    triangle.png

    I hope this might be usefull to someone :)

    @mitu Thanks again for your quick reply!

  • 0 Votes
    7 Posts
    2k Views
    mituM

    @bishop If you think so, then you shouldn't have posted the link. I removed the site link, since it's obviously still not free to redistribute.

  • Ubuntu 19.04 issues

    Help and Support
    28
    0 Votes
    28 Posts
    6k Views
    ParabolaralusP

    @BuZz Id love to help, but i have absolutely no idea what to do with that...It would be easy for me to set up a clean VM and test what you did, but im clueless as to what to do with that link.
    Edit: Fail

  • SDL2 and OpenMSX

    Help and Support
    4
    0 Votes
    4 Posts
    618 Views
    mituM

    @Efriim said in SDL2 and OpenMSX:

    How do I install libSDL2_ttf? What other problems do I face that the libraries are not found? What happened to them?

    The libsdl-ttf2.0 package is installed automatically as a dependency for OpenMSX . You probably removed manually, outside of the RetroPie-Setup script.