A A A
Please consider registering
guest
sp_LogInOut Log In
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters – maximum search word length is 84 characters
sp_Feed Topic RSSspace
PSA (with code): How to fix Retroarch custom viewports with ANY screen resolution..
November 27, 2021
7:43 pm
MyRetrozz
Member
Official-Punks
Forum Posts: 60
Member Since:
March 16, 2020
sp_UserOfflineSmall Offline

Greetings programs!

 

I’ve been struggling with this for a couple of years on and off.. trying to make Retroarch work with custom viewports (for that perfect console look) on ANY resolution.

The scenario:

1) You spend months building the best emulated versions of all old consoles ever.. (in 6 volumes!) playtest to death.. bring them to a friends house to test and…

2) Your friend has one of those crazy ‘superwidescreen’ monitors (game developers.. go figure!) – I am pretty sure that monitor is about 3′ wide! In any event.. your awesome creation.. LOOKS LIKE CRAP. Didn’t scale properly at all.

First solution.. try various routines to detect 1080p or 4k (using DXDIAG or other built in windows functions) and select a custom config accordingly (retroarch.cfg)

Yet.. on some friends who have CRAZY widescreen monitors.. who lknows what resolution that is btw.. (8k?)

Mull it over for a while.. and ask a BRAND NEW developer.. just learning coding. who says ‘I am learning Python’

Being oldskool (yes started coding on 6502 assembler..endless nights pouring through code on a C64 to ‘make legitimate backups 😉 ) have no experience with Python, but like anything else.. ‘How hard could it be??’

Well.. it turns out.. extremely simple!

This December.. re-releasing MyRetrozz Classic Minis Volume 1 (31 systems IIRC) with this FIXED, finally once and for all.

In true hac..err coder style, here is my entire source code, I wrote this in spare time over the course of 1 day.. and no I am nowhere near an expert in Python. Yes, could certainly optimize etc.. but code is readable and doesn’t have to be fast for what it does.

What does it do:

1) Reads a custom config file for these key values:

Custom viewport width

Custom viewport height

Custom viewport x position

Custom viewport y position

These are PERCENTAGE values.. meaning percentage of user’s screen size (so viewport width/screen width = percentage value, which is just multiplied back again and put into retroarch.cfg)

The final version shipped will be full .exe so NO python is required on end user machine. If users want to mess with the viewport, just update the .ini file which will be in the root directory. As you’ll see in the source code, nothing is hardcoded.

Here is the link to the source code.. hopefully this will help others for their projects utilizing Retroarch

https://1fichier.com/?90hiv40js3tmb26megcq

Included in this archive:

1) The .py python script with commentary for every portion

2) A sample .retroarch.cfg file (in my loader routine, I grab retroarch.cfg from the .
etroarch directory), modify it, and put it back before running the game. The eventual goal is ALL loader routines will be ported to Python (read the VIC 20 loader to see insane routines required sometimes!)

3) A sample .ini file. I think those percentages were based on a initial 3840×2160 screen. You have to have a ‘base’ config to create your ‘percentage scale’ values, which will be used for EVERY other resolution.

4) A fake ‘header file’.. because retroarch doesn’t have the format of .ini with a [header] which can be read by the config loader) – note: I am just pre-pending the header to retroarch.cfg. Note: retroarch doesn’t seem to care about the additional header during loading and autostrips it out (doesn’t affect anything at all!) so makes it a bit easier for coding this.

Check the source code inside, .py and determine which libraries you need to PIP install..

December 11, 2021
8:27 am
MyRetrozz
Member
Official-Punks
Forum Posts: 60
Member Since:
March 16, 2020
sp_UserOfflineSmall Offline

Just a quick update.. working through updating MyRetrozz Minis Volume 1 (30+ systems) with this new automagiccalculator screen size thingy module(as a full windows executable so no special setup at all by users)

Taking opportunity to update most of the cores (Retroarch) as well to ensure maximum compatibility.

In some cases.. adding new roms (homebrew) to  some systems.

Hopefully into the ‘packaging’ phase soon and re-upload well in time for Christmas!

Note: The entire “Volume  1” will just fit on a 1TB  drive. makes a perfect gift for friends/family over the  holidays.

December 13, 2021
12:26 am
Avatar
Ninja UK
Admin
Forum Posts: 2339
Member Since:
May 14, 2015
sp_UserOfflineSmall Offline

cant wait!

Forum Timezone: Europe/London
Most Users Ever Online: 3117
Currently Online: Mister Muscolo, rayrod1985, Sonic Star
Guest(s) 31
Currently Browsing this Page:
1 Guest(s)
Top Posters:
canter6: 134
Jaz808: 121
davep180: 74
SteelCityJJ: 74
kme2019: 61
Misa Misa: 58
-x-: 53
MyRetrozz: 51
sergiohyperspin: 45
hipp0: 40
Member Stats:
Guest Posters: 122
Members: 125979
Moderators: 31
Admins: 2
Forum Stats:
Groups: 7
Forums: 35
Topics: 3514
Posts: 10858
Newest Members:
yoruichi99, Sonic Star, ISRAEL SANTOS SILVA, Top G, alex moran, Andy Zur, Francisco Galvez Aniorte, littletinymonkey, philippe da costa, Jan Dolezal
Moderators: aladdin: 0, Arcade Man: 0, Arcade Punk: 0, CP78: 0, ETA PRIME: 0, Ghost Lost: 0, Harrison Hacks: 0, T.K.O. Cinematics: 0, kiodiekin1: 0, level1online: 0, hursty1: 0, Neighbourhood Techie: 0, Maria: 0, PatmanQC: 0, Restalgia: 0, RetroHumanoid: 0, Simply Austin: 0, titipilas: 0, Titi Ober: 179, Enkak: 28, leepspvideo: 0, _RetroTech100: 0, Guest Post: 0, Mark Blackwood: 0, Frankie Wilde: 0, Jeremy Reynolds: 0, Leslie Alexander: 0, Jason Copley: 0, Eleonora: 0, Joshua Robinson: 0, James Collins: 0
Administrators: Ninja UK: 2227, peter laws: 0

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More