          eLoader v0.98  (the "Porter" release)
          -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

by Noobz!

Official Website: http://www.noobz.eu
Official Forum:   http://forums.qj.net/forumdisplay.php?f=205
Official IRC:     #noobz on irc.toc2rta.com

(based on excellent groundwork by Saotome)

NOTE : THIS PROGRAM ALLOWS YOU TO RUN HOMEBREW EBOOTs ON YOUR
       v2.0+ PSP.
       IT CANNOT LOAD EBOOT.PBPs THAT CONTAIN FIRMWARE UPDATES.

This program builds on the work done by Saotome to load homebrew
EBOOT.PBPs into PSPs with v2.00-v2.60 firmware, using the TIFF exploit,
or on v2.00, v2.01, 2.5 and 2.6 using the GTA exploit.

It currently cannot run all known homebrew, but it uses a number
of tricks to get substantially further than ever before.
Known limitations are:

- Can't run kernel-mode applications.
  - That means anything that emulates ISOs/UMDs.
- Some minor system calls are still unsupported.

It's also still very much in development, so you should expect
a few bugs, and for not every EBOOT to run perfectly.  An
up-to-date list of known working EBOOTs can be found at the
official website.


Major new features in this release:
-----------------------------------

- Support for homebrew on all firmwares from v2.00 - v2.60, without
  the need for the Grand Theft Auto game.

  v2.70 and above are not yet supported - this is being worked on.

TERMS OF USE:
-------------

This software is made available for use as-is, without any
guarantee of usability, safety, fitness for purpose etc.  We've
taken all reasonable precautions to ensure that it cannot
damage your PSP, but cannot be held responsible for any damage
caused.

You are not permitted to sell this software.  If you paid money
for this program (most often through eBay), you should demand a
refund of your payment, and report the seller to the appropriate
authorities.

This program is not intended to aid piracy of any form.  Use for
piracy is strictly forbidden - we want to support software
developers, not steal from them.


To install:
-----------

The recommended way to install is to use the new installer for
Windows-based PCs.  This is 'eloader098.exe'.  Just connect
your PSP to the PC, then double-click this file, and follow the
instructions to install the loader to your memory stick.  Note
that this will overwrite the GTA files of any previous eLoader
release.

Alternatively, if you don't have a Windows PC, you can extract
the files from the eLoader098.zip package manually:

- Extract all the files into the root folder (e.g.  "F:\") of
  your memory stick.  You need these files to be in the right
  place:

     \l_098.bin
     \README.TXT
     \psp\eloader\loadmenu098.pbp
     \psp\eloader\loadmenu.tga
     \psp\eloader\loader098.cfg
     \psp\eloader\gta200.nid
     \psp\eloader\gta250.nid
     \psp\eloader\gta260.nid
     \psp\eloader\vsh200.nid
     \psp\eloader\vsh250.nid
     \psp\eloader\vsh260.nid
     \psp\photo\eLoader 098\aaa.gif
     \psp\photo\eLoader 098\run_098.tif
     \psp\savedata\ULES00182S5\DATA.BIN
     \psp\savedata\ULES00182S5\ICON0.PNG
     \psp\savedata\ULES00182S5\PARAM.SFO
     \psp\savedata\ULES00182S5\PIC1.PNG
     \psp\savedata\ULES00182S5\tetris.bin
     \psp\savedata\ULUS10041S5\DATA.BIN
     \psp\savedata\ULUS10041S5\PARAM.SFO
     \psp\savedata\ULUS10041S5\PIC1.PNG
     \psp\savedata\ULUS10041S5\icon0.png
     \psp\savedata\ULUS10041S5\tetris.bin
     \psp\savedata\ULES00151S5\DATA.BIN
     \psp\savedata\ULES00151S5\ICON0.PNG
     \psp\savedata\ULES00151S5\PARAM.SFO
     \psp\savedata\ULES00151S5\PIC1.PNG
     \psp\savedata\ULES00151S5\tetris.bin
     \utils\EBOOT_signature.exe
     \utils\touch.exe


Installing Homebrew:
--------------------

- Copy the homebrew you want to run to your memory stick.
  Usually, this means unzipping a directory that contains an
  EBOOT.PBP file to somewhere under \PSP\GAME\.  The exact
  location and folder name usually doesn't matter, but for best
  compatibility you should try to use the same names as
  originally shown in the homebrew ZIP file.

  If the instructions with the homebrew contain separate steps
  for v1.0 and v1.5 firmwares, then usually you'll get best
  results by following the v1.0 instructions.

  NOTE: If the homebrew is written in LUA, you need to copy it
  to a subdirectory under the your LUA Player "APPLICATIONS"
  folder.


  The method for running eLoader itself depends on which
  version of the PSP firmware you have installed.  Refer to the
  appropriate section below:

Running eLoader : via TIFF mode
-------------------------------

- Make sure you have a custom wallpaper set.  Any image will do.

- Use the PSP's built-in photo viewer to open the "eLoader 098"
  folder, this will cause the loader to start.  If your PSP
  hangs at this point, then try the following:

     - check your firmware version.  This loader is for v2.0 - v2.6
       ONLY.
     - check that you have the loader files in the correct
       place (see above)
     - turn your PSP completely off, then back on again.
       The loader works best on a freshly-rebooted PSP.
     - try setting a custom background - some people have
       reported that it works better if you use a custom
       wallpaper (any image).
     - try 'touching' the TIF image file : see 'fixing
       up the file times' below.

Running eLoader : via GAME mode
-------------------------------

- Load up the GTA game from the UMD.

- Open the menu with 'START', then select 'Load Game'.

- Select the eLoader icon from the list of saved games.
  Confirm that you want to discard current progress.

- The eLoader should start after a few seconds.

- If instead, GTA loads a normal savegame, then you have the
  patched version of GTA (see below).


Which version of GTA do I use?
------------------------------

There are now 2 main versions of the GTA game available -
"patched" and "unpatched".  The patched version will not run
eLoader - it has been fixed by RockStar Games, and we can't do
anything about it.

There are many rumoured ways to tell the two versions apart,
here are some, in order of reliability from most to least:

- The patched version contains a v2.6 firmware update, the
  unpatched version contains v2.0.  You can see which version is
  included by looking under the GAME icon in the main PSP
  system menu, when the UMD is inserted in your PSP.

- Look at the serial number on the UMD, for unpatched
  European copies, it should say "ULES-00151#1", patched copies
  should say "ULES-00151#2".

- If there is a picture of Tony on a bike, next to a plane,
  on the back cover of the box, then it is probably an
  unpatched copy.  You can view a thread on the forums about
  this here:
    http://forums.qj.net/f-psp-games-6/t-easy-way-to-tell-is-patched-or-not-gtalcs-58823/


Using eMenu:
------------

- The loader displays a list of folders in \PSP\GAME.  Use the up
  and down buttons to change the current selection (highlighted
  with a black line), and X or O to run the homebrew in that
  folder.

  NOTE: To load LUA applications, you need to run LUA Player
  first, which will launch Lowser and let you browse to open
  the application.

- Once you select some homebrew to load, the menu will exit,
  and after a few moments, the loader will either display an
  error message, or the homebrew will start.

- To exit the homebrew, you need to reboot your PSP.  The
  loader contains in-built support for rebooting, by holding
  the Left Trigger, Right Trigger and START buttons together
  for a few seconds.  If this doesn't work, then you can also
  reboot by removing the battery, or holding the power switch
  for at least 10 seconds.  Note that sometimes after a
  software reboot, the loader will hang if you try to run it
  again.  This seems to be much rarer if you enter USB mode
  briefly, before running the loader again.

- Other buttons:
  - Triangle will turn on USB mode.
  - Square will take a screenshot of the menu.
  - The L and R shoulder buttons change the PSP's clock speed.
  - SELECT will show usage instructions, and rescan the memory
    stick for new homebrew.
  - START will exit the menu.
  - HOLD will put the PSP into 'slumber mode' - the clock speed
    is set to minimum, and the screen is blanked.  You can get
    further power saving by holding the 'SCREEN' button to turn
    off the screen, before engaging 'HOLD'.

- If you get the message 'Not Homebrew', it means that the
  selected folder does not contain the file 'EBOOT.PBP' in the
  topmost subfolder.  This usually means that you've incorrectly
  installed the homebrew.


Using multiple versions of eLoader
----------------------------------

Occasionally, some EBOOTs work better with older versions of
the loader.  In v0.9.5, for example, it looks like
TerraIncognita is broken, but this works fine on 0.9.  Also,
LUA can be very unpredictable, working in some loader versions
for some people, and other versions for others.

From 0.8 onwards, the loader uses version numbers in the
filenames, so that you can run multiple versions side-by-side.

After installing v0.9.8, you can continue to use any
previously-installed versions of the loader, if you have
problems with your favourite EBOOTs.

Note that this doesn't work by default for GTA.  If you want to
keep your old version of eLoader for GTA, you need to copy the
following files from your GTA save slot 5 into another slot
before installing v0.9.8:
  - tetris.bin
  - icon0.png
  - pic1.png


Using a different menu
----------------------

v0.9.8 of the loader ships with a default menu, emenu--.pbp.

You can also download an optional menu, called 'Choice', from
this location:

   http://www.xart.co.uk/downloads/choice.php

The loader will use emenu--.pbp menu by default.  If
you want to use one of the alternatives, then edit the
loadmenu098.cfg file (with Notepad, or any other text editor),
and change the following line:

  menu=ms0:/psp/eloader/emenu--.pbp

or

  menu=ms0:/psp/photo/choice/choice.pbp
           (or wherever you placed Choice, if
           it is in a different location).


Troubleshooting
---------------

If you have problems with an individual EBOOT getting to the
"Press X to launch the program" screen, but crashing
immediately after, here are a few things to try:

- Check whether it is already on the list of non-working EBOOTs
  at www.psp-homebrew.eu.

- Make sure you are trying to run it as the first thing you do
  after a clean reboot of your PSP

- Use v1.0 EBOOTs in preference to v1.5.

- Make sure that you read any README supplied with the
  homebrew, and followed the installation instructions (for
  v1.0, preferably) carefully.

- Make sure that any support files (e.g.  WAV files, graphics
  files) contained in the ZIP file are copied into the same
  place on the memory stick, relative to the EBOOT file.

- Experiment with the launcher options in the configuration
  file.  (see below)

- Check the forums at pspupdates.com - someone might already
  have found a way to make this EBOOT work.

- When starting the eLoader, try pressing the "down" button
  very quickly immediately after pressing "X" to open the
  'eLoader' photo folder.  This can help the stability of some
  apps.

- If you see a message during the loading process, saying
  "Found suspicious hard path", then this means the loader
  detected that the application depends upon being in a
  specific location on the memory stick.  Usually the path will
  mention a specific file - try moving the application folder
  so that the file is in the place shown.

If you find that one of these steps helps, then please send me
details on what you did to make the EBOOT work - I can build
the workarounds automatically into the next version of the
loader.

NOTE: If the eLoader aborted the process before reaching the
"press X" screen, then don't bother trying these steps -
there's no way that EBOOT will currently work, but please
remember to send the details of the error message to me, so
that I can attempt to change the code to make it work.


Fixing up the file times:
-------------------------

If you have problems with the PSP freezing as soon as you open
the PHOTO folder, or even if it just starts the eLoader as soon
as you open the PHOTO folder, and you want to be able to view
photos normally, then you can use the enclosed TOUCH.EXE file
to help out:

- Copy touch.exe to the \psp\photo\ folder on your memory stick.

- Open a windows command prompt (click "Start", "Run...", and
  enter "cmd" in the box that comes up).

- In the command prompt, enter these commands:
   >   F:
           (replace 'F' with the drive letter of your
           memory stick)
   >   cd "\psp\photo\eLoader 098"
   >   ..\touch run_098.tif


Configuration File:
-------------------

v0.8.5 and beyond of the loader support configuration via a
file, /psp/eloader/LOADER098.CFG.  See inside the file for
basic details on what the various options do.  For most
purposes, the defaults should be sufficient.

If you want to try to tweak the options for a specific EBOOT,
here are some pointers:

- Each EBOOT has a special signature that identifies it to the
  eLoader.  To find out the signature, use the bundled Windows
  program "EBOOT_SIGNATURE.EXE".  This will tell you the name
  you need to use for the config file section header for the
  EBOOT.

- The following options are the most common ones to change to
  make a specific EBOOT work.  Often, changing one of these
  (more-or-less at random) will fix the more sensitive EBOOTs
  such as USER_LUA.  Try changing these one at a time, in this
  order, for best results.

     - passparameters    : this is the same as the old 'press Square for
                           alternate parameters' option.
     - confirm
     - callinit          : this is the same as the old 'press L-Trigger' option
     - clearscreen
     - initbssfull
     - initbsspartial

- If you want to suppress screen-spam during loading of a
  known-good EBOOT, you can try changing these options.  You
  may find that the EBOOT stops working after changing an
  option - if so, just change it back.

     - confirm            : displays the 'press X to start' menu
     - unknownNIDwarning  : warns you if some system calls
                            requested by the EBOOT couldn't be
                            identified.
     - patchkernelwarning : warns you if the EBOOT is
                            kernel-mode. For some EBOOTs, this
                            doesn't matter.
     - ignorefixedpath    : warns you if the EBOOT contains a
                            suspicious- looking filename, that
                            implies it might need to be run
                            from a fixed location on the memory
                            stick.

If you find some new configuration parameters that work well
for a specific EBOOT, please email us at homebrew@noobz.eu,
or make a post on the EBOOT loader forums at pspupdates.com.


Future plans:
-------------

Please see the "Work In Progress" page at www.noobz.eu.

If you find some new homebrew that either does or doesn't work
on your PSP, then please consider adding your results to the
PSP homebrew database at www.psp-homebrew.eu.  Anyone with
a free account there is able to add to the data, and it's
a great way of checking whether other people have been able
to run particular homebrew on a similar PSP setup to yours.

NOTE: Although kernel-mode support is currently feasible on v2.0+
firmware, with the new kernel-mode exploit, it is not currently
implemented in eLoader.


Acknowledgements:
-----------------

This app wouldn't have been possible without the toc2rta TIFF
exploit code, or Saotome's hard work on the first beta EBOOT
loader, or the support of the fantastic folks at the ps2dev.org
forums (especially Groepaz's list of NID -> syscall mappings,
and Vampyre's continuing efforts to expand that list). And later,
of course, the new TIFF exploit that opens up access to homebrew
on v2.0-v2.8 - thanks to psp250, Skylark, NOPx86, Jim Paris,
Chris Swindle, joek2100 and Fanjita for that.

Thanks to Edison Carter (and later Jim Paris and psp123) for
the development of the GTA savegame exploit, which made
homebrew possible on v2.01+.

Thanks to all the forum mods at PSPUpdates.QJ.net, and
operators in the #fanjita IRC channel, for supporting all the
questions from eLoader users.  Special thanks to Serideth, who
seems to never sleep.

Thanks also to the many beta testers for their hard work beta
testing, as well as many other individual email contributions
with information on which EBOOTs are working.

If you have found this program useful and want to encourage
further development, please consider donating a small amount
via paypal to donations@noobz.eu.

Change history:
---------------
  v0.9.8 : TIFF homebrew support on FW v2.01 - v2.60
    - Added support for the new TIFF exploit.  Support for v2.7+ is
      still a work-in-progress.

  v0.9.7 : Wifi for all
    - Add dynamic wifi loading support: automatically
      determines whether your application requires wifi, and
      loads the correct libraries.
    - Added config parameter to control warning if wifi can't
      be loaded.
    - Added config parameter to control code relocation (might
      help some apps)
    - Added memory stick scan-caching in the menu.

  v0.9.6 : Configurability, Infra-Red
    - Support SIRCS infra-red (GTA only)
    - Added config option to use old memory manager code
      (might help some apps)
    - Added config option to limit thread stack sizes (helps
      some apps)
    - Moved config option to clear RAM after menu on a
      per-EBOOT basis
    - Moved config option to delete user-main thread on a
      per-EBOOT basis
    - Moved config option to delete system threads on a
      per-EBOOT basis - Allowed separate configs for GTA and
      TIFF
    - Add USB support to the menu (TIFF only)
    - Support O as well as X to select in the menu
    - Added square to generate EBOOT ID in menu
    - Fixed most corrupted images in menu
    - Fix clearRAMafterMenu option for TIFF
    - Fixed "patchkernelwarning" bug
    - Added GTA autoload option to installer
    - Made fixed paths easier to change with hex editor
    - Add latest config update

  v0.9.5 : v2.01 / v2.5 / v2.6 support!
    - Added stable GTA exploit loader
    - Rewrote NID resolution code to support different
      firmware versions.
    - Removed kernel-mode warning by default
    - Improved audio stability
    - Improved thread tidy-up upon program exit - no more dead
      copies of user_main lying around.
    - Improved memory tidy-up and integration with system heap:
      this gives more memory available to homebrew, and is a
      factor in the GBA emulator now working.
    - Massively improved stability, especially for GTA
    - Added config option to not call exit callback (should
      help with apps that crash on exit)
    - Added config option to not automatically prevent display
      dimming (saves power)
    - Added config option to control system bus speed.
    - Added automated installer for Windows

  v0.9 : Wifi support, stability
    - Added wifi support!  Now the loader auto-detects if the
      wifi libraries are loaded (via the wifi load method
      above) and offers them to homebrew for use.
    - Added call to application exit callback, to allow RIN
      etc. to save state when L+R+START reset is used.
    - Added memory reset after running the menu.  This should
      make things much less sensitive to whatever has been run
      before them.  Can be turned off in config.
    - Added memory reset on exit - this might make it easier
      to restart the loader.
    - Added config option to fake success code from unknown
      functions
    - Added clock-speed option to the config file, to allow
      automatic overclocking / underclocking of applications.

  v0.8.5 : Flexibility, compatibility
    - Introduce configuration file, to allow tweaking of
      EBOOTs by end-users. See loader085.cfg for details.
    - Improved kernel-mode override patching logic.
    - Attempt to kill surplus system threads, for stability.
    - Run loader from reserved memory for increased stability.
    - Tidied up some memory reuse in ELF section header
      handling
    - Bundled graphical menu now filters to only display the
      names of EBOOTs for selection - all the surplus fluff is
      hidden.  Also now handles v1.5 homebrew directory structure.
    - Added option to allow L+R+START reset to go back to
      loader menu, rather than main menu

  v0.8 : Usability, compatibility
    - Added capability to reboot the PSP without holding the
      power button. During any EBOOT, just hold Left Trigger,
      Right Trigger and START buttons for 1 second to exit the
      loader and reboot back to the PSP menu.
    - Separated menu binary from loader binary, to allow
      custom menu creation. Included custom menu by Calum.
    - Added kernel-mode override facility - allows the loader
      to attempt to load apps marked as kernel-mode, that
      don't really require kernel access.  This doesn't enable
      a huge number of apps, but it does enable a few - e.g.
      ScummVM 0.5, PSPChess, Nethack.  Expect more progress in
      the future.
    - Relax requirement to resolve all NIDs.  Now you can
      choose to ignore failed NIDs in the hope that they
      aren't required.
    - Improved USER_LUA stability (by incorporating the 0.7
      USER_LUA patch)
    - Added PowerTick() call to prevent display dimming during
      play
    - Skip calling .init code by default
    - Allow easier co-existence of multiple loader versions.
    - Improve memory and thread manager semaphoring.
    - Added all remaining VSH-mode NIDs, thanks to Vampyre's work.
    - Moved working EBOOT list to new web-page.
    - Filled in some missing opcodes from the disassembler
    - Added syscall dereferencing to disassembler
    - Added hook to sceKernelCreateThread, to improve thread
      monitoring
    - Reduced screen spam during loading, by moving it to
      debug-only build
    - Attempt to load more of the ELF sections into RAM if
      appropriate
    - Retired hokey malloc implementation during file load,
      use proper memory blocks now.

  v0.7 : Compatibility, usability
    - Implement simple internal memory manager, hooked onto
      firmware memory management, to boost memory pool
      available to applications.
    - Hook thread allocation and exit, to allow for clean
      return to the loader from applications that support an
      Exit option.
    - Improve code signature algorithm to distinguish between
      similar EBOOTs (fixes mis-identification of Casino
      Addict as SMS emulator).
    - Added overclocking option : use left and right trigger
      buttons when choosing file to change CPU speed.
    - Add NID resolution for Sircs function : enables PSP IR
      Remote function.
    - Add USB stubs to user-mode LUA, and better debug info in
      case of script errors.
    - Added left and right DPAD support in file-chooser, to go
      to the start and end of the list
    - Now supports more than 20 files in a directory
    - Found pathname hack to run PSP Rhythm Composer.
    - Improved cache flushing, should improve reliability
    - Added safeguard to prevent PSPSet from being run and
      bricking 2.0.

  v0.6 : Compatibility and stability
    - bundle user-mode LUA player.
    - only process stringtable section header and .reginfo,
      all others are unused.
    - setup $gp register from .reginfo
    - change folder thumbnail to smaller image, improves
      launch stability.
    - added scan for EBOOTs with hard-coded paths.
    - clear display RAM before starting some EBOOTs, to clear
      up some graphical anomalies.
    - added direct seek to ELF header - much much faster file
      loading.

  v0.5 : More compatibility enhancements, bug fixes
    - Better argc/argv handling, prevents a common cause of
      startup crashes (e.g. PSP Schedule).
    - Made the 'return to chooser' function more stable.  It
      now shouldn't affect how well the next EBOOT loads.
    - Improved file scanning speed - large EBOOTs should load
      much faster.
    - Added 'alternate startup parameters', use this to run
      Sega Master System emulator which was broken in v0.4.
    - Introduced 'EBOOT signatures' : known workarounds for
      specific EBOOTs should now be turned on automatically,
      and install location can be automatically checked if a
      specific path is required.
    - Added support for .init sections, should help avoid a
      few more startup crashes.
    - Added option to return to EBOOT chooser on final
      confirmation menu.
    - Version number shown on screen fixed.
    - Lots more info in readme file.
    - Various minor bugfixes.

  v0.4 : Usability & reliability enhancements
    - Return to menu if possible after failed load.  NOTE :
      this is a bit flaky, and mainly designed for quick
      checks for kernel-mode apps, etc.  If something crashes
      after you ran through a few EBOOTs that wouldn't load,
      it's worth retrying it immediately after a reboot.
    - Experimented with exception handlers for extra
      diagnostics, but this is not possible in user-mode (and
      anyway the appropriate syscall code is unknown for v2.0).
    - Fixed overflow with more than 19 directory entries - now
      apps that failed just after EBOOT selection will get
      further.
    - Added set up of argv, argc to supply path arguments -
      helps for Ghost In The Matrix, possibly others.
    - Changed load address to 0x0860000, to allow more
      headroom for increased loader complexity.  Also begun
      integrating Abu's loader code with the TIF file.

  v0.3 : Compatibility enhancements
    - Allow browsing of multiple EBOOTs
    - Change directory to selected EBOOT location
        (adds sounds to Attack of the Mutants)
    - Restore screen mode before running EBOOT
        (improves reliability)
    - Allow multiple text segments in ELF

  v0.2 : Original version, ported to C from original v0.1
      EBOOT loader by Saotome.
