2.2 KiB
Auto LBA
Table of Contents
To support the Auto LBA
feature changes need to be applied to the source files and the CD configuration file. The changes for the source files depend on if they are an Overlay or part of the main executable.
In Code
To use the Auto LBA
feature the LBAs first need to be defined in either an enum
or enum struct
. These need to fit a special pattern.
__jabyengine_start_lba_request
needs to be the first entry while __jabyengine_end_lba_request
needs to be the last. Each LBA entry needs to be declared with __jabyengine_request_lba_for
followed by the name for the enum entry and the file path on the disk.
#include <PSX/AutoLBA/auto_lba.hpp>
enum LBA {
__jabyengine_start_lba_request
__jabyengine_request_lba_for(SYSTEM_CNF, "SYSTEM.CNF"),
__jabyengine_end_lba_request
};
Overlay
For use with Overlays you need to include the related header file. You must place this include into the Namespace of your overlay to avoid name clash. Now the lba
array is accessible.
namespace Overlay {
#include <PSX/Overlay/overlay_declaration.hpp>
// ...
printf("LBA: %i, Words: %i\n", lba[LBA::SYSTEM_CNF].lba, lba[LBA::SYSTEM_CNF].size_words);
// ...
__declare_overlay_header(execute, LBA);
}
Main file
For use with the main file you need to include the header file and use the __declare_lba_header
macro with the name of your enum to create the LBA area in any file. The header allows to access the lba
array with your enum as the index.
#include <PSX/AutoLBA/auto_lba_declaration.hpp>
// ...
printf("LBA: %i, Words: %i\n", lba[LBA::SYSTEM_CNF].lba, lba[LBA::SYSTEM_CNF].size_words);
// ...
__declare_lba_header(LBA);
For CD generation
To automatically fill the LBA values psxcdgen_ex
needs to be used.
For the main file the special XML type Main
needs to be used while specifing the LBA file being used.
For Overlays the instruction will follow...
<Track>
<File name="SYSTEM.CNF">System.cnf</File>
<Main name="SCES_XXX.XX" lba_source="main.cpp">Application.psexe</Main>
</Track>