[Tutorial] How to make Mari0 portable (Windows)

General Mar0 discussion has been moved to this subforum!
Post Reply
User avatar
Raicuparta
Posts: 539
Joined: 04 Feb 2012, 02:07
Contact:

Post » 08 Mar 2012, 21:34

Introduction
This tutorial is for more inexperienced people, so if you know your way around Windows you should be able to just skim through it.
The main problem with making Mari0 (and other LÖVE games) a portable app (by portable I mean possible to store on a removable device so you can run it on other computers) is that LÖVE saves all the user files in the %AppData% folder. So if the binares were to be copied to a pen drive and run on another computer, all the user defined settings, DLC, custom mappacks, etc, would be reset to the default values. To bypass this, we need to find a way to take those files with us as well. The obvious way to do this would be to just copy those files to the storage device every time you want to transport it, and then copying them back to the %AppData% folder when you are on another system. But this can be an inconvenience and some computers may actually block access to these directories (although I'm not sure if they also usually block procedures like the one explained in this thread).

Copying the files to the storage device
While this method can work using the source (.love) files, it is recommended that you use the Windows .exe version of the game, or else it won't work if you don't have LÖVE installed on the computer you try to play the game on.
Nothing to fancy here, just copy the binary and dll files to your storage device, create a new folder for it if you want. Copy all the essential files, "mari0_x.x.exe" (x.x is the version), DevIL.dll, OpenAL32.dll, and SDL.dll.
After this, create a new directory, and call it LOVE. We will use this in the next step.

Getting the user files
Now we need to find our Mari0 user files. For Windows 7 and Vista, these are usually located under "C:\Users\<user name>\AppData\Roaming\LOVE\mari0", where "C:" is the drive where your OS is installed, and <user name> is your Windows user name. For Windows XP, it is under "C:\Documents and Settings\<user name>\Application Data\LOVE\mari0"
Now copy the entire mari0 folder from %AppData% to the LOVE folder yjust ou created inside your storage device. This means that inside your device, you should have something like "X:/Portable Mari0/LOVE/mari0".

Creating the script
Now all we need is a way for the system to look to the LOVE folder inside our storage device, instead of trying to get it from the %Appdata% folder.
You can either download the .bat script here: http://www.mediafire.com/?z6vcwj987b3373x
Or make your own. You might need to edit the previous script, depending on the name of your Mari0 .exe. All you need is a plain text editor.
The .bat file should contain the following lines:

Code: Select all

set APPDATA=%CD%
mari0_1.4.exe
The first line tells the system to look into our storage device instead of the system's %AppData% folder, and the second line runs the game exe. You'll have to adjust this depending on the game version or if you changed it's name.
You can simply copy those lines, paste them in notepad or any other plain text editor, and save it as a .bat file (when saving, choose Save As - All Files" and choose a name that ends in .bat )
You can name it whatever you want, as long as it ends in .bat . In my case, I named it "play.bat". Be sure to save it in the same directory as the Mari0 .exe, or else it won't work.
Now every time you want to play the game, you run this .bat file.

Hope this is helpful, and if you know how to proceed in order to achieve the same goal in other operating systems, post your tutorial and I'll add it to this thread.

User avatar
RumblezMan
Posts: 153
Joined: 12 Feb 2012, 00:20

Post » 08 Mar 2012, 23:37

can't we just copy the appdata folder and put in right location?

Post Reply