RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    crt-pi shader users - reduce scaling artifacts with these configs in lr-mame2003, lr-fbalpha, lr-nestopia (and more to come)

    Scheduled Pinned Locked Moved Ideas and Development
    crt-pi shadercrt-picrt-pi-verticalshaderslr-mame2003
    385 Posts 42 Posters 262.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • RiverstormR
      Riverstorm @Rion
      last edited by

      @Rion said in crt-pi shader users - automatic usage of crt-pi-vertical in vertical games in lr-mame2003:

      @dankcushions

      Thank you for all your hard work.

      I edited the mame2003-crt-pi-vertical-overrides and created one with the names changed to .zip.cfg so these can go right in to the roms folder.

      Here mame2003-crt-pi-vertical-overrides-cfg (Put in roms\mame-libretro)

      Here is also one with mame2003-crt-pi-curvature-vertical-overrides

      And last one mame2003-crt-pi-curvature-vertical-overrides-cfg (Put in roms\mame-libretro)

      These are nice additions to Dank's work, thank you!

      1 Reply Last reply Reply Quote 1
      • RionR
        Rion @dankcushions
        last edited by

        @dankcushions said in crt-pi shader users - automatic usage of crt-pi-vertical in vertical games in lr-mame2003:

        for the curious, i created a little script that went through the lr-mame2003 source-code and pulled out the list of roms that are rotated, and from that it created the relevant .cfg files. we could potentially do the same for other arcade emulators but i'll leave that for someone else.

        I'm interested in how you did this. I have several plans for creating cfg's for games that are not vertical and add a standard arcade overlay beazel for them.

        Same for fba neogeo only roms and so on.

        dankcushionsD 1 Reply Last reply Reply Quote 0
        • dankcushionsD
          dankcushions Global Moderator @Rion
          last edited by

          @Rion said in crt-pi shader users - automatic usage of crt-pi-vertical in vertical games in lr-mame2003:

          @dankcushions said in crt-pi shader users - automatic usage of crt-pi-vertical in vertical games in lr-mame2003:

          for the curious, i created a little script that went through the lr-mame2003 source-code and pulled out the list of roms that are rotated, and from that it created the relevant .cfg files. we could potentially do the same for other arcade emulators but i'll leave that for someone else.

          I'm interested in how you did this. I have several plans for creating cfg's for games that are not vertical and add a standard arcade overlay beazel for them.

          Same for fba neogeo only roms and so on.

          with mame(2003) it was easy as the source code has easy to find strings for all the vertical games. eg:

          https://github.com/libretro/mame2003-libretro/blob/7b55725e744ac9702db092f996e2fca2276146b2/src/drivers/pacman.c#L4356

          GAME( 1981, maketrax, crush,    pacman,   maketrax, maketrax, ROT270, "[Kural] (Williams license)", "Make Trax (set 1)" )
          GAME( 1981, maketrxb, crush,    pacman,   maketrax, maketrax, ROT270, "[Kural] (Williams license)", "Make Trax (set 2)" )
          GAME( 1981, korosuke, crush,    pacman,   korosuke, korosuke, ROT90,  "Kural Electric", "Korosuke Roller" )
          GAME( 1981, mbrush,   crush,    pacman,   mbrush,   0,        ROT90,  "bootleg", "Magic Brush" )
          GAME( 1981, paintrlr, crush,    pacman,   paintrlr, 0,        ROT90,  "bootleg", "Paint Roller" )
          GAME( 1982, ponpoko,  0,        pacman,   ponpoko,  ponpoko,  ROT0,   "Sigma Enterprises Inc.", "Ponpoko" )
          GAME( 1982, ponpokov, ponpoko,  pacman,   ponpoko,  ponpoko,  ROT0,   "Sigma Enterprises Inc. (Venture Line license)", "Ponpoko (Venture Line)" )
          

          anything with ROT90 or ROT270, i know is a rotated CRT screen so is a vertical game. you can get the zip name from the same string. i used some REGEX in a little python script to get the info (i think... i can't find it now). i then wrote this python script to go through that list and build the .cfgs:

          fileName = "rotatedgames.txt"
          myFile = open(fileName, "r" )
          print('opened file', fileName)
          
          for gamename in myFile:
          	# strip line breaks
              gamename = gamename.rstrip()
              print('creating .cfg for', gamename)
          
              # create cfg file
              cfgFileName = gamename + '.cfg'
              newCfgFile = open(cfgFileName, 'w')
              newCfgFile.write("# Auto-generated crt-pi-vertical.glslp .cfg\n")
              newCfgFile.write("# Place in /opt/retropie/configs/mame-libretro/MAME 2003/\n")
              newCfgFile.write("video_shader_enable = \"true\"\n")
              newCfgFile.write("video_shader = \"/opt/retropie/emulators/retroarch/shader/crt-pi-vertical.glslp\"\n")
          
          myFile.close()
          

          i had a quick look at FBA and the code didn't lend itself to the same approach i think.

          dankcushionsD 1 Reply Last reply Reply Quote 1
          • RionR
            Rion
            last edited by Rion

            @dankcushions

            Thank you for posting you script but for me this is useless because i don't know how to use python.. Yet.

            But maybe you can help me nonetheless .

            I have here a complete list of all the neogeo roms present in FBA 0.2.97.39 (New version right around the corner)

            Can you help me create or guide me to how i can make cfg files with these templates?

            Content of 2020bb.cfg In /home/pi/RetroPie/roms/mame-libretro/ "for example"

            video_shader = "/opt/retropie/emulators/retroarch/shader/crt-pi-curvature.glslp"
            video_shader_enable = "true"
            
            input_overlay = /home/pi/RetroPie/roms/mame-libretro/overlays/2020bb.cfg
            input_overlay_enable = true
            input_overlay_opacity = 0.800000
            input_overlay_scale = 1.000000
            
            aspect_ratio_index = "0"
            
            video_scale_integer = true
            

            Content of 2020bb.cfg In /home/pi/RetroPie/roms/mame-libretro/overlays/

            overlays = 1
            
            overlay0_overlay = Final_Arcade_NeoGeo_Horizontal.png
            
            overlay0_full_screen = true
            
            overlay0_descs = 0
            

            I was thinking about using this as an overlay Final_Arcade_NeoGeo_Horizontal

            FloobF 1 Reply Last reply Reply Quote 0
            • FloobF
              Floob @Rion
              last edited by

              @Rion I may be mis-understanding, but all you have to do to get the config to work (if you dont want to use the original method posted at the top) is to rename 2020bb.cfg to 2020bb.zip.cfg and put it in the rom directory.
              You could batch rename a whole set if you dont want to do it manually.

              Please read the Docs before asking a new question.
              RetroPie Help Guides: https://goo.gl/3gcNsT

              1 Reply Last reply Reply Quote 0
              • dankcushionsD
                dankcushions Global Moderator @dankcushions
                last edited by

                @Rion said in crt-pi shader users - automatic usage of crt-pi-vertical in vertical games in lr-mame2003:

                @dankcushions

                Thank you for posting you script but for me this is useless because i don't know how to use python.. Yet.

                But maybe you can help me nonetheless .

                I have here a complete list of all the neogeo roms present in FBA 0.2.97.39 (New version right around the corner)

                Can you help me create or guide me to how i can make cfg files with these templates?

                that's basically what my script above does. do you want me to keep re-writing it in different languages until you find one you like? ;)

                RionR T 2 Replies Last reply Reply Quote 0
                • RionR
                  Rion @dankcushions
                  last edited by

                  @Floob said in crt-pi shader users - automatic usage of crt-pi-vertical in vertical games in lr-mame2003:

                  @Rion I may be mis-understanding, but all you have to do to get the config to work (if you dont want to use the original method posted at the top) is to rename 2020bb.cfg to 2020bb.zip.cfg and put it in the rom directory.
                  You could batch rename a whole set if you dont want to do it manually.

                  @Floob Yes i know i posted some edited cfg files a few post up for this. I looked at you files on how to do this from you're rp-video-manager.

                  What i wanted to do was to create cfg files for every NeoGeo games on that list and that is something i don't know how to do using python.

                  @dankcushions said in crt-pi shader users - automatic usage of crt-pi-vertical in vertical games in lr-mame2003:

                  @Rion said in crt-pi shader users - automatic usage of crt-pi-vertical in vertical games in lr-mame2003:

                  @dankcushions

                  Thank you for posting you script but for me this is useless because i don't know how to use python.. Yet.

                  But maybe you can help me nonetheless .

                  I have here a complete list of all the neogeo roms present in FBA 0.2.97.39 (New version right around the corner)

                  Can you help me create or guide me to how i can make cfg files with these templates?

                  that's basically what my script above does. do you want me to keep re-writing it in different languages until you find one you like? ;)

                  Sorry i will try to figure it out on my own..

                  1 Reply Last reply Reply Quote 0
                  • RiverstormR
                    Riverstorm
                    last edited by

                    @Rion You should have all the pieces you need it looks like.

                    1. Your game list is already done and just needs to be added to a text file.

                    Create something like rionsgames.txt and paste the list into the file.

                    2020bb
                    2020bba
                    2020bbh
                    3countba
                    3countb
                    ...

                    1. Dank gave you the Python script with some documentation and informational messages printed to screen while it's running which is really handy. It looks straight forward enough you could modify the lines to match your templates to write both files out at once that you want created for each game.

                    Any programming experience should apply. In the code example the file rotatedgames.txt is being opened, then the first line (game name) is being read which would be 2020b (as the first entry from your list), it's then stripped of line breaks and used as the config file name of the new template you're creating, the last section is writing the new config information of each line. You can modify or add lines as needed.

                    If you take a look at the script it's well formatted and broken down into 3 main sections. You just need to change the line fileName = "rionsgames.txt" to your game list file. Your first lines would be something similar to this in the last section of the code taken from your template:
                    newCfgFile.write("video_shader = \ "/opt/retropie/emulators/retroarch/shader/crt-pi-curvature.glslp\"\n").
                    The second line:
                    newCfgFile.write("video_shader_enable = \"true\"\n")

                    The third line would be a bit more tricky as you have the game name in the line for the overlay.

                    newCfgFile.write("input_overlay = \"/home/pi/RetroPie/roms/mame-libretro/overlays/$cfgFileName\"\n")

                    I don't know much about Python but there's several ways to add variables depending on the version. I am not quite sure though. Maybe old fashioned is using $cfgFileName. If you have most of the script I am sure someone would be able to look it over.

                    RionR 1 Reply Last reply Reply Quote 1
                    • RionR
                      Rion @Riverstorm
                      last edited by

                      @Riverstorm Thank you!

                      It's alot more clear to me now. Will report back with the results and hopefully upload the cfgs to dropbox for everyone else to enjoy.

                      1 Reply Last reply Reply Quote 0
                      • RiverstormR
                        Riverstorm
                        last edited by Riverstorm

                        You might need to change the filename variable to cfgFileName = gamename + '.zip.cfg'. Which is adding the .zip to the filename. Then create a new variable like cfgOverlay = gamename + '.cfg' for use in the 3rd line naming the overlay file.

                        It's a bit confusing but \"true\" translates to "true" the backslash before it is telling to interpret it as literal and not a special meaning to Python. \n is a linefeed (go to the next line). The last double quote is working with the first double quote just enclosing the whole string.

                        Python line:
                        newCfgFile.write("video_shader_enable = \"true\"\n")

                        Output (the string part): video_shader_enable = "true" (with a line feed \n to go the next line).

                        Python line:
                        print('opened file', fileName) (or whatever name is held in the variable fileName)
                        Output:
                        opened file rionsgames.txt

                        Python line:
                        print('creating .cfg for', gamename)
                        Output:
                        creating .cfg for 2020bb

                        You might to define a new variable and add another section at the bottom for the overlay file creation or copy the file and tweak it if you want to use the same variables for creating the overlay file.

                        cfgOverlay = gamename + '.cfg' (Overlay file name to be created with a .cfg extension basically 2020bb + .cfg = 2020bb.cfg

                        newOVFile = open(cfgOverlay, 'w') (Open overlay file for writing)
                        Add overlay file lines here.

                        Dank did a nice job and did all the ground work but it's so close to what you want I think a few tweaks and it should work nicely.

                        1 Reply Last reply Reply Quote 1
                        • RionR
                          Rion
                          last edited by Rion

                          Thank you again @Riverstorm for explaning this to me.

                          I got it working

                          Here is the code

                          fileName = "fba_neogeo_029739.txt"
                          myFile = open(fileName, "r" )
                          print('opened file', fileName)
                          
                          for gamename in myFile:
                          	# strip line breaks
                              gamename = gamename.rstrip()
                              print('creating .cfg for', gamename)
                          
                              # create cfg file
                              cfgFileName = gamename + '.zip.cfg'
                              newCfgFile = open(cfgFileName, 'w')
                              newCfgFile.write("# Auto-generated crt-pi-curvature .cfg for NeoGeo\n")
                              newCfgFile.write("# /home/pi/RetroPie/roms/mame-libretro//\n")
                              newCfgFile.write("video_shader_enable = \"true\"\n")
                              newCfgFile.write("video_shader = \"/opt/retropie/emulators/retroarch/shader/crt-pi-curvature.glslp\"\n")
                              newCfgFile.write("input_overlay = /home/pi/RetroPie/roms/neogeo/overlay/Final_Arcade_NeoGeo_Horizontal.cfg\n")
                              newCfgFile.write("input_overlay_enable = true\n")
                              newCfgFile.write("input_overlay_opacity = 0.800000\n")
                              newCfgFile.write("input_overlay_scale = 1.000000\n")
                              newCfgFile.write("aspect_ratio_index = \"0\"\n")
                              newCfgFile.write("video_scale_integer = true\n")
                          
                          myFile.close()
                          

                          But i could not get
                          newCfgFile.write("input_overlay = "/home/pi/RetroPie/roms/mame-libretro/overlays/$cfgFileName"\n")
                          to work.

                          Luckily because this was only NeoGeo games i could point them all to one cfg file in the overlay folder.

                          But i would like to solve it when i start to look at adding a generic arcade-bezels to vertical games in lr-mame2003.

                          Anyway here are the results for everyone to download.

                          Just put them into you neogeo roms folder in "/home/pi/RetroPie/roms/neogeo"

                          neogeo-crt-pi-curvature-Final_Arcade_NeoGeo_Horizontal-bezel-.zip.cfg

                          Here is how its going to look when finished.
                          SNK NeoGeo

                          Thanks to:
                          John.Merrit over at libretro forums for creating this in the first place.
                          @dankcushions for the python script!
                          @Floob for his work with rp-video-manager and making these work for the pi.
                          @Riverstorm For explaining this to me in an easy way ;)

                          RiverstormR 1 Reply Last reply Reply Quote 0
                          • RiverstormR
                            Riverstorm @Rion
                            last edited by Riverstorm

                            @Rion said in crt-pi shader users - automatic usage of crt-pi-vertical in vertical games in lr-mame2003:

                            I got it working

                            That's great! I know that variable is probably the issue. It's just my lack of knowledge of Python. You might try the line below. I think that will work. Basically you enclose in quotes before and after the cfgFileName variable concatenating it all as one string with the plus sign. It's a little more confusing with extra \ and " throughout the line but basically the same as before. Basically "string" + variable + "string" but we want double quotes to enclose the string after the = sign so there's two extra \" in the line. For example after +cfgFileName+ in the line if you remove the beginning and end quotes it's basically \" (double quote) and \n (new line).

                            You probably know this :) but both the config file and overlay file are the same name: <game name>.cfg you would need to take that into account so they don't overwrite each other. You could run write it out to another directory or run it in a separate folder.

                            newCfgFile.write("input_overlay  = \"/home/pi/RetroPie/roms/mame-libretro/overlays/"+cfgFileName+"\"\n")
                            
                            RionR 1 Reply Last reply Reply Quote 1
                            • RionR
                              Rion @Riverstorm
                              last edited by

                              @Riverstorm said in crt-pi shader users - automatic usage of crt-pi-vertical in vertical games in lr-mame2003:

                              @Rion said in crt-pi shader users - automatic usage of crt-pi-vertical in vertical games in lr-mame2003:

                              I got it working

                              That's great! I know that variable is probably the issue. It's just my lack of knowledge of Python. You might try the line below. I think that will work. Basically you enclose in quotes before and after the cfgFileName variable concatenating it all as one string with the plus sign. It's a little more confusing with extra \ and " throughout the line but basically the same as before. Basically "string" + variable + "string" but we want double quotes to enclose the string after the = sign so there's two extra \" in the line. For example after +cfgFileName+ in the line if you remove the beginning and end quotes it's basically \" (double quote) and \n (new line).

                              You probably know this :) but both the config file and overlay file are the same name: <game name>.cfg you would need to take that into account so they don't overwrite each other. You could run write it out to another directory or run it in a separate folder.

                              newCfgFile.write("input_overlay  = \"/home/pi/RetroPie/roms/mame-libretro/overlays/"+cfgFileName+"\"\n")
                              

                              Well that did the trick!

                              Thank you. Now lets start looking at the Generic Bezel for vertical games... :)

                              1 Reply Last reply Reply Quote 0
                              • T
                                twd Banned @dankcushions
                                last edited by

                                This post is deleted!
                                1 Reply Last reply Reply Quote 0
                                • S
                                  Sharkus
                                  last edited by

                                  BTW, I found that I needed to put the override .cfg files here to get them to work with Retropie 4:

                                  /opt/retropie/configs/all/retroarch/config/MAME 2003

                                  D 1 Reply Last reply Reply Quote 0
                                  • D
                                    Dochartaigh @Sharkus
                                    last edited by

                                    I'm going to try this tonight! Thank you!

                                    I've done this manually twice recently! ...thankfully I only play around 100 MAME games total so there weren't too many vertical ones.

                                    1 Reply Last reply Reply Quote 0
                                    • RionR
                                      Rion
                                      last edited by Rion

                                      This post is deleted!
                                      dankcushionsD 1 Reply Last reply Reply Quote 1
                                      • edmaul69E
                                        edmaul69 @dankcushions
                                        last edited by

                                        @dankcushions so i created a folder called MAME 2003 in /opt/retropie/configs/mame-libretro added all the files and it didnt work. then today i updated rpie setup script then updated mame 2003 from binary and still doesnt work. still only sees the crt-pi.glsl i have tried many roms. i am on a pi 3 with retropie 4.01 but i updated retroarch yesterday and mame 2003 today

                                        1 Reply Last reply Reply Quote 0
                                        • edmaul69E
                                          edmaul69 @dankcushions
                                          last edited by edmaul69

                                          This post is deleted!
                                          1 Reply Last reply Reply Quote 0
                                          • edmaul69E
                                            edmaul69
                                            last edited by

                                            Since i have no special mame configs and since i couldnt get this to work so i just used bulk rename utility to add the .zip into the names.

                                            RionR 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                            Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.