OldSchool Library
General

General routines to initialize and terminate the library. More...

Macros

#define OSL_VERSION   "1.3.0"
 OSLib version.
 
#define oslSetQuitOnLoadFailure(enabled)
 Sets the "no fail" mode.
 
#define oslSetQuitOnLoadFailureCallback(function)
 Sets the function to call in case of failure to load something.
 
#define oslSetExitCallback(function)
 Sets an exit callback.
 

Enumerations

enum  OSL_INITFLAGS { OSL_IF_USEOWNCALLBACKS = 1 , OSL_IF_NOVBLANKIRQ = 2 }
 Flags for oslInit function. More...
 

Functions

void oslInit (int flags)
 Initializes the library.
 
void oslQuit ()
 Exits the application immediately.
 
void oslHandleLoadNoFailError (const char *filename)
 Handles errors when a file fails to load in "no fail" mode.
 

Variables

int osl_intraInit
 Indicates if the internal initialization process of OSLib is complete.
 
int osl_noFail
 Controls the "no fail" mode in OSLib.
 
void(* osl_noFailCallback )(const char *filename, u32 reserved)
 Pointer to the callback function used when a file load operation fails in "no fail" mode.
 

Detailed Description

General routines to initialize and terminate the library.

These functions are responsible for setting up and tearing down the OSLib environment. Initialization typically involves configuring system settings and allocating necessary resources, while termination handles cleanup and resource deallocation.

Macro Definition Documentation

◆ oslSetQuitOnLoadFailure

#define oslSetQuitOnLoadFailure ( enabled)
Value:
(osl_noFail = (enabled))
int osl_noFail
Controls the "no fail" mode in OSLib.

Sets the "no fail" mode.

In this mode, if OSLib cannot load a file (for example, an image), it will display a message indicating the name of the missing file and then quit immediately.

Parameters
enabledEnables or disables the no-fail feature.

◆ oslSetQuitOnLoadFailureCallback

#define oslSetQuitOnLoadFailureCallback ( function)
Value:
(osl_noFailCallback = function)
void(* osl_noFailCallback)(const char *filename, u32 reserved)
Pointer to the callback function used when a file load operation fails in "no fail" mode.

Sets the function to call in case of failure to load something.

The default behavior is to display a message box. This function allows you to override that behavior with your custom function.

Parameters
functionFunction pointer to be called on load failure.

◆ oslSetExitCallback

#define oslSetExitCallback ( function)
Value:
(osl_exitCallback = function)
int(* osl_exitCallback)(int arg1, int arg2, void *common)
Pointer to the exit callback function.

Sets an exit callback.

This function is executed when the user chooses "Exit" from the HOME menu. By default, this callback sets osl_quit to true, indicating that the application should quit. You can provide your custom callback function to handle the exit process.

Parameters
functionFunction pointer to be executed as the exit callback.

Enumeration Type Documentation

◆ OSL_INITFLAGS

Flags for oslInit function.

These flags control specific aspects of the initialization process.

Enumerator
OSL_IF_USEOWNCALLBACKS 

Do not set up the standard callbacks. You'll have to provide them by yourself as shown in almost all PSPSDK samples.

OSL_IF_NOVBLANKIRQ 

Do not reserve the VBLANK IRQ. You should set up your own VBL handler, which should call oslVblankNextFrame() if osl_vblankCounterActive is TRUE, else oslSyncFrame(Ex) will not work properly.

Function Documentation

◆ oslInit()

void oslInit ( int flags)
extern

Initializes the library.

This function initializes the OSLib environment. The flags parameter is used to control specific initialization options, which are primarily intended for advanced users.

Parameters
flagsCan be formed of one or more of the values from the OSL_INITFLAGS enumeration (ORed together).

◆ oslQuit()

void oslQuit ( )
extern

Exits the application immediately.

This function terminates the application and returns to the XMB (PSP main menu) or to the calling application (e.g., IRShell).

◆ oslHandleLoadNoFailError()

void oslHandleLoadNoFailError ( const char * filename)
extern

Handles errors when a file fails to load in "no fail" mode.

This function is called internally by OSLib when a file fails to load and "no fail" mode is enabled. It invokes the callback function specified by osl_noFailCallback if one is set, or displays a default error message and quits the application.

Parameters
filenameThe name of the file that failed to load.

Variable Documentation

◆ osl_intraInit

int osl_intraInit
extern

Indicates if the internal initialization process of OSLib is complete.

This variable is used internally by OSLib to track the state of the library's initialization. It is set to 1 when the initialization is complete and 0 otherwise.

◆ osl_noFail

int osl_noFail
extern

Controls the "no fail" mode in OSLib.

This variable is used to enable or disable the "no fail" mode, which automatically quits the application with an error message if a file cannot be loaded.

  • 0: "No fail" mode is disabled.
  • 1: "No fail" mode is enabled.

◆ osl_noFailCallback

void(* osl_noFailCallback) (const char *filename, u32 reserved) ( const char * filename,
u32 reserved )
extern

Pointer to the callback function used when a file load operation fails in "no fail" mode.

This function is called whenever a file fails to load while "no fail" mode is enabled. The callback function receives the name of the file that failed to load and a reserved parameter that can be used for additional context.

Parameters
filenameThe name of the file that failed to load.
reservedReserved parameter for additional context (usually not used).