Portable Mode?

Discussion in 'ePSXe Archive' started by mccorkled, Jul 24, 2015.

  1. mccorkled

    mccorkled New Member

    Messages:
    12
    Likes Received:
    0
    Is there a way to run ePSXe in portable mode? All of my other emulators files are all stored within the emulator folder and with ePSXe the settings are store in the registry file and everytime something happens to I disconnect the drive I have to input all the settings again.

    Edit: Can a mod please move this to the discussion forum, I accidentally clicked archive :\
  2. NGEmu.com Advertisement

  3. Erzesel

    Erzesel Master of Eselhimmel

    Messages:
    413
    Likes Received:
    45
    Its possible using a little Trick.
    If you start ePSXe over an Batch, you can automatically import/export all Settings from/to .reg-files.
    Code:
    echo off
    ::If existing saved settings, write them to registry:
    if exist ePSXe_portable.reg REGEDIT.EXE /s ePSXe_portable.reg
    if exist plugins_portable.reg REGEDIT.EXE /s plugins_portable.reg
    ::start ePSXe
    epsxe.exe
    ::save all actual settings to regfiles:
    REGEDIT.EXE /s /e ePSXe_portable.reg "HKEY_CURRENT_USER\Software\epsxe"
    REGEDIT.EXE /s /e plugins_portable.reg "HKEY_CURRENT_USER\Software\Vision Thing\PSEmu Pro"
    ::ask to delete all ePSXe-Entrys from Guestcomputer:
    echo Delete all ePSXe-Entrys fom this  Computer?
    SET /P X= (Y)es or (N)o?
    if /I "%X%"=="Y" goto :kill
    if /I "%X%"=="N" goto :end
    ::else same as "N"
    goto end
    :kill
    Reg delete "HKCU\Software\epsxe" /f
    Reg delete "HKCU\Software\Vision Thing\PSEmu Pro" /f
    :end
    
    Put the Batchfile "epsxe_portable.cmd" in your ePSXe-folder (at usbdisk or what ever).
    Run epsxe_portable.cmd.
    At the First run at your Homecomputer there no existing plugins_portable.reg and ePSXe_portable.reg and nothing to write at the registry.
    epsxe will start with the Setting from your Registry.
    After closing ePSXe all available Settings are exported into 2 .regfiles (plugins_portable.reg and ePSXe_portable.reg) in the ePSXe-Folder.
    Then you will be asked for Deleting the Setting (from Rgistry).
    At your own PC answer "N" [enter].
    "Y"es deletes the Registry Entrys (no matter they are now saved into files).


    At a Guestcomputer start the batch as above.
    The now existing Regfiles are written to the Registry.
    epsxe start with this settings
    (only the Memcards and Bios must be set manually if the Computer is changed)
    (Its possible to adjust the Memcard/Bios-path automaticly, but i will wait that this Batch is an Option for you.)(its a bit more tricky --or not-- to doe it in Batch)
    After Closing ePSXe the last Settings are stored back to the Regfiles.
    At a Guestcomputer you can choose for Delete the entrys (or not)...

    Attached Files:

    Last edited: Jul 25, 2015
    mccorkled likes this.
  4. mccorkled

    mccorkled New Member

    Messages:
    12
    Likes Received:
    0
    Ok thanks, that worked great. I am not so worried about the memory cards but can you tell me how to add the line to do the bios settings?
  5. Erzesel

    Erzesel Master of Eselhimmel

    Messages:
    413
    Likes Received:
    45
    The old donkey had some boredom...:rolleyes:
    There were a few lines more then one. (3 rows had actually enough to adapt the Biospath. But now I also it for the Memcards)
    Finally it not liked me the old query and I have written also a QuerryBox.
    Code:
    echo off
    if not exist ePSXe.exe echo %~n0%~x0 is not in ePSXe-Path & goto end
    
    ::If existing saved settings, write them to registry
    ::else it make no sense to doe something as start directly ePSXe
    if  not exist ePSXe_portable.reg goto run
    REGEDIT.EXE /s ePSXe_portable.reg
    if not exist plugins_portable.reg goto run
    REGEDIT.EXE /s plugins_portable.reg
    
    ::replace the Driveletter from last Biosfile, McrFiles and Shader by Driveletter from actual StartDrive
    ::...and save it  to Registry
    
    ::-----Get Driveletter form where this Batchfile is started
    set ePSXeDrv=%~d0
    
    
    ::-----Get last BiosPath and Biosfile ---a little cryptic
    ::-----batch and getting a Sting is a science it self
    for /f "tokens=2*" %%a in ('REG QUERY "HKCU\Software\epsxe\config" /v "BiosName"') do set "BiosDrv=%%~db" & set "BiosPath=%%~pb"  & set "FullBiosName=%%~nb%%~xb"
    ::-----Replace the Last Driveletter with them from above
    set newBiosFile=%ePSXeDrv%%BiosPath%%FullBiosName%
    ::-----Check the new Path
    if  exist %newBiosFile% goto Biosfile_found
    ::Errormanagment...hope never see this Boxes...
    echo MsgBox "There is something wrong!" ^& vbCrLf ^& "Biosfile %FullBiosName% not found in changed Path %ePSXeDrv%%BiosPath% " ^& vbCrLf ^& "...must set manually in ePSXe",48,"No Bios" >%temp%\msg.vbs
    echo WScript.Quit(123456) >>%temp%\msg.vbs
    WScript //Nologo %temp%\msg.vbs
    if  %errorlevel%==123456 goto MsgBox1_ok
    ::only  2 lines Batch-echo if VBScrript can't run
    echo There is something wrong!
    echo Biosfile %FullBiosName% not found in changed Path %ePSXeDrv%%BiosPath%
    pause
    :MsgBox1_ok
    del %temp%\msg.vbs
    :Biosfile_found
    ::-----Write the changed Path back to the Registry
    reg add "HKCU\Software\epsxe\config" /v "BiosName" /t Reg_SZ /d "%newBiosFile%" /f >nul
    
    ::-----Same as Bios but whith Memcard 1
    for /f "tokens=2*" %%a in ('REG QUERY "HKCU\Software\epsxe\config" /v "Memcard1"') do set "MC1Drv=%%~db" & set "MC1Path=%%~pb"  & set "FullMC1Name=%%~nb%%~xb"
    set NewMC1Path=%ePSXeDrv%%MC1Path%%FullMC1Name%
    if  exist %NewMC1Path% goto MC1_found
    ::Errormanagment:
    echo MsgBox "Memorycard 1:" ^& vbCrLf ^& "%FullMC1Name% not found in changed Path %ePSXeDrv%%MC1Path% " ^& vbCrLf ^& "...must set manually in ePSXe",48,"No Bios" >%temp%\msg.vbs
    echo WScript.Quit(123456) >>%temp%\msg.vbs
    WScript //Nologo %temp%\msg.vbs
    if  %errorlevel%==123456 goto MsgBox2_ok
    ::only  2 lines Batch-echo if VBScrript can't run
    echo Memorycard 1: %FullMC1Name% not found in changed Path %ePSXeDrv%%MC1Path%
    pause
    :MsgBox2_ok
    del %temp%\msg.vbs
    :MC1_found
    reg add "HKCU\Software\epsxe\config" /v "Memcard1" /t Reg_SZ /d "%NewMC1Path%" /f >nul
    
    ::-----Same as Bios but whith Memcard2
    for /f "tokens=2*" %%a in ('REG QUERY "HKCU\Software\epsxe\config" /v "Memcard2"') do set "MC2Drv=%%~db" & set "MC2Path=%%~pb"  & set "FullMC2Name=%%~nb%%~xb"
    set NewMC2Path=%ePSXeDrv%%MC2Path%%FullMC2Name%
    if  exist %NewMC2Path% goto MC2_found
    ::Errormanagment:
    echo MsgBox "Memorycard 2:" ^& vbCrLf ^& "%FullMC2Name% not found in changed Path %ePSXeDrv%%MC2Path% " ^& vbCrLf ^& "...must set manually in ePSXe",48,"No Bios" >%temp%\msg.vbs
    echo WScript.Quit(123456) >>%temp%\msg.vbs
    WScript //Nologo %temp%\msg.vbs
    if  %errorlevel%==123456 goto MsgBox3_ok
    ::only  2 lines Batch-echo if VBScrript can't run
    echo Memorycard 2: %FullMC2Name% not found in changed Path %ePSXeDrv%%MC2Path%
    pause
    :MsgBox3_ok
    del %temp%\msg.vbs
    :MC2_found
    reg add "HKCU\Software\epsxe\config" /v "Memcard2" /t REG_SZ /d "%NewMC2Path%" /f >nul
    
    ::do it for last ISOpath but seems ignored by ePSXe
    for /f "tokens=2*" %%a in ('REG QUERY "HKCU\Software\epsxe\config" /v "IsoDirectory"') do set "IsoDrv=%%~db" & set "IsoPath=%%~pb"  & set "FullIsoName=%%~nb%%~xb"
    set NewIsoPath=%ePSXeDrv%%IsoPath%%FullIsoName%
    if exist %NewIsoPath% reg add "HKCU\Software\epsxe\config" /v "IsoDirectory" /t REG_SZ /d "%NewIsoPath%" /f >nul
    
    ::adjust ShaderPath
    for /f "tokens=2*" %%a in ('REG QUERY "HKCU\Software\Vision Thing\PSEmu Pro\GPU\PeteOpenGL2" /v "ShaderDir"') do (set "ShaderDrv=%%~db" & set "ShaderPath=%%~pb")
    set newShaderPath=%ePSXeDrv%%ShaderPath%
    ::no Error handling it work...:p
    REG ADD "HKCU\Software\Vision Thing\PSEmu Pro\GPU\PeteOpenGL2" /f /v "ShaderDir"  /t REG_SZ /d  "%NewShaderPath%\" >nul
    
    
    :run
    epsxe.exe
    
    
    ::save all actual settings to regfiles:
    REGEDIT.EXE /s /e ePSXe_portable.reg "HKEY_CURRENT_USER\Software\epsxe"
    REGEDIT.EXE /s /e plugins_portable.reg "HKEY_CURRENT_USER\Software\Vision Thing\PSEmu Pro"
    
    ::ask to delete all ePSXe-Entrys from Guestcomputer:
    echo wscript.quit MsgBox ("Delete all ePSXe-Entrys fom this Computer? ",4,"ClenUp") >%temp%\msg.vbs
    WScript //Nologo %temp%\msg.vbs
    if %errorlevel%==6 set Answer=Y
    if %errorlevel%==7 set Answer=N
    del %temp%\msg.vbs
    if  not "%Answer%"=="" goto MSGBox_answered
    
    ::alternating query from prompt if VB-scrip  not work
    echo Delete all ePSXe-Entrys fom this Computer?
    SET /P Answer= (Y)es or (N)o?
    :MSGBox_answered
    if /I "%Answer%"=="Y" goto :kill
    if /I "%Answer%"=="N" goto :end
    ::else same as "N"
    goto end
    
    :kill
    ::delete the entrys --leave behind no traces---
    Reg delete "HKCU\Software\epsxe" /f >nul
    Reg delete "HKCU\Software\Vision Thing\PSEmu Pro" /f >nul
    goto end
    :end
    
    I hope it works... i've changed the Driveletter of my USBStick any times...and all new paths are recognized.

    The next batch you can write yourself. :D Now you know indeed how it goes ...

    There is not allways need for complex programing languages and everyone can change the code simply without compilers or something. Only a Editor is needed.

    Edit: added adjust Shaderfolder

    Attached Files:

    Last edited: Jul 27, 2015
    mccorkled likes this.
  6. mccorkled

    mccorkled New Member

    Messages:
    12
    Likes Received:
    0
    You are great man! Thank you very much :) I use to be able to program things but that was many years ago when vb.net first came out. Hopefully I will not need to mess with this ever again! :D
  7. mccorkled

    mccorkled New Member

    Messages:
    12
    Likes Received:
    0
    I just tried using this and it seems like it does not save the settings. I ran it and it asked to delete the reg files from the computer but it did not save them into my epsxe folder...

    Unless I am using this wrong?
    Last edited: Jul 27, 2015
  8. Erzesel

    Erzesel Master of Eselhimmel

    Messages:
    413
    Likes Received:
    45
    Now I have some time. (Sometimes I have to do something:rolleyes: that have i have some meat on my bread...:D)

    I have some thought about why your system does not save the .reg files in the ePSXe folder.
    The only acceptable solution, you have NTFSformatted the USBharddrive where the folder created on. So it can be that you have no rights to write a file. (At a FAT32-USB-stick is this no Problem , there no Rightsmanagment at FAT32)
    If you will save at NTFS-Drive Files in to a Folder created as Admin and plugged this to Computer where you only have Standarduser-rights you cant create or save files.
    Change the folder and file Permissions for your ePSXe-folder to full access for all users. Or Use a Fat32 USBDrive.

    I've tested the Batch with a normal 8GBstick and my and my sons computer and it works perfect. All Settings are always adjusted to the DriveLetter of my USBstick.
    It even works with a guest account on a computer in Intenetcafe.
    So i think it's only a thing of rights. The Batchsolution seems not perfect but ok (so far).

    Before starting ePSXe_portable.cmd:
    no ePSXe-Entry at the Registry.
    The Filetimes of .regfiles are from yeserday:
    capture_28072015_105439.jpg

    when running ePSXe with ePSXe_portable.cmd from USBdrive:
    The at yesterday saved ePSXe-entris are written to Registry .
    Filetimes fom yeserday.
    capture_28072015_105628.jpg

    After closing ePSXe and answer "yes" to Delete the Entrys:
    The ePSXe_Key and all Settings are removed form Registy.
    The .regfiles are updated (look at filetimes).
    capture_28072015_105735.jpg
    Last edited: Jul 28, 2015
  9. mccorkled

    mccorkled New Member

    Messages:
    12
    Likes Received:
    0
    Interesting...

    I have NTFS but I have admin rights...
  10. papermanzero

    papermanzero New Member

    Messages:
    61
    Likes Received:
    7
    registry entries are so outdated. Why not using a config file?
  11. Erzesel

    Erzesel Master of Eselhimmel

    Messages:
    413
    Likes Received:
    45
    I'm a hobby-programer since 30 years and our one thinks sometimes very convenient.
    Ini-files are a lazy way for programmers to don't write a userinterface. (what a nice userinterface named Notepad :p)
    No normal user should look behind a GUI-Window and never open a progams Folder or related file as other we can complete go back to the dosprompt:confused:.
    To say to a normal user:"change registryentry xyz" is realy a bad idea. the registry is a holy cow...

    The registry-concept is technically much better then inis. (But need a GUI to prevent users from kill the cow;))
    To store a entry into the Registry and get them back is much simpler then then doe this with a inifile.
    Only two Lines (including Variabledeclaration) are needed to store or redrive a value.
    c# style:
    store something:
    RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\MyKey");
    key.SetValue("blah", 3);

    get it back:
    RegistryKey key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\My");
    int width = key.GetValue("blah")

    doe the same from windows commandline:
    store:
    REG ADD HKCU\Software\MyKey /v blah /d "3"

    get it back:
    REG QUERY HKCU\Software\MyKey /v blah


    More is not need only one line per value.
    A programmer don't must think about how to store or get back.
    The problem with inifiles, there is no simple way to manage data in inifiles and every programer must cook his own parser.
    Look into the ePSXe's Folder:
    There are in bad constellation 5 or more Folders where programers store there inifiles :
    • \ePSXe\ (ePSXe-shark, ePSXeLauncher, ...)
    • \ePSXe}\config\
    • \ePSXe\configs\ (blade)
    • \ePSXe\ini (epsxe-shark, ogl2tweak...)
    • \ePSXe\plugins\ini\ (harakiri)

    as hardboiled ePSXe is installed as administrator into a folder without userrights, then all this folders are unusable to store data.
    Above Windows7 windows redirect userdata from some writeprotected Folders automatically into a "vstore"-folder ( and it's very hard tho find the data as the Adminprofile store its data into the right folders and files).
    All this have to doe with Windows securitymanagment.
    To you want search the whole System for right configfile from a bad documented program.
    If i want to write a Frontend for ePSXe it's nice to find the settings of all important things in 2 Registrykeys. (nice for every programer) .

    It was a good concept. Now every young wild programmer stores his Data where ever he belove and frontends like ePSXecutor are working nomore. Programing a new Fronend make no sense as long all the emu and pluginprogramers not agreed about one shareable datastore-API.

    The windows registry API is a good documented API and all i at one place to find.

    I don't know this young programmers they are happy fight with stupid parsers and writeprivileges to files and folders. (why ??? only one line is needed to store/get data in/from a hierarchical database) .

    Well for some users the Registry is a holy or mystical place and fiddle with a textfile seems them more secure but i think if everyone can write as free into a programs folder noone must ask why he get viruses and malware. A user have normally nothing to manipulate in scurityrelevant areas like progamfolders!
    Last edited: Dec 28, 2015
  12. papermanzero

    papermanzero New Member

    Messages:
    61
    Likes Received:
    7
    If you are only focused on Windows, this is a possible approach.
    With Linux and OSX, the registry approach is not the way to be flexible.
    Nowadays you cannot focus on one particular system. That's what I mean with outdated.

    Qt for example provides a very smart solution to get settings from different files, which is also compatible with several OSs.
  13. Erzesel

    Erzesel Master of Eselhimmel

    Messages:
    413
    Likes Received:
    45
    In sight of multiSystem compatibility , i agree.
    The XML_API of Qt is really a good approche...

    ...must be consistent concept to store per program and not that what happens 5 config folders for one program are a bad idea ;).
    and the only one shared configfolder should at Windowssystem at a non-admin/userfolder.
    (personaly i have done this by symlink all userwritable folders of old programs into a documents-subfolder)
    So ( at my own Windows) it is imposible for malware to write in programfolders.

    However ePSXe is using the registry even the most plugins.
    If they wont the ePSXe-programmers will change this.
    But as long Petes OGL2 is closed source noone can change something.
    (except through the back door like OGL2tweak)
    I do not understand why Pete does not disclose the code. In the coming years, the 32-bit system will disappear and with it its famous plugins.
    From Windows 7 and above, the 32bit memorymanagment is only emulated for compatibility.that will not be possible forever
    Last edited: Dec 28, 2015
  14. papermanzero

    papermanzero New Member

    Messages:
    61
    Likes Received:
    7
    Yes, that is true, that due to closed source many great developments will die, due to changes in technology.
    It's the same for Kega Fusion. One of the best Sega Emulators and the only one with almost perfect x32 emulation.
    Although ekeeke's Genesis Plus GX emulator is better in terms of accuracy, it is only available through retroach and it is lacking x32 emulation.
    Also the "blade suite" like bladesoftgpu, bladecdr etc. are closed source. Although the knowledge about the source code, like the implementation of quad rendering, would be beneficial for everyone who deals with PSX emulators.

    I hope someone picks up open source plugin alternatives, like GSDX, and improves these with the latest achievements like GTE accuracy, filtering, etc.

Share This Page