|
OldSchool Library
|
Main Oldschool Library header file. More...
#include <pspkernel.h>#include <pspdisplay.h>#include <pspdebug.h>#include <stdlib.h>#include <stdio.h>#include <malloc.h>#include <math.h>#include <string.h>#include <ctype.h>#include <time.h>#include <pspctrl.h>#include <psputility.h>#include <pspgu.h>#include <pspgum.h>#include <psppower.h>#include <pspiofilemgr.h>#include <psphprm.h>#include "oslmath.h"#include "vram_mgr.h"#include "VirtualFile.h"#include "drawing.h"#include "map.h"#include "text.h"#include "messagebox.h"#include "keys.h"#include "audio.h"#include "bgm.h"#include "usb.h"#include "dialog.h"#include "osk.h"#include "saveload.h"#include "net.h"#include "browser.h"#include "adhoc/pspadhoc.h"#include "ccc.h"#include "sfont.h"Data Structures | |
| struct | OSL_MEMSTATUS |
| Structure for the return value of oslGetRamStatus. More... | |
Macros | |
| #define | OSL_VERSION "1.4.0" |
| OSLib version. | |
| #define | oslSetQuitOnLoadFailure(enabled) (osl_noFail = (enabled)) |
| Sets the "no fail" mode. | |
| #define | oslSetQuitOnLoadFailureCallback(function) (osl_noFailCallback = function) |
| Sets the function to call in case of failure to load something. | |
| #define | oslSetExitCallback(function) (osl_exitCallback = function) |
| Sets an exit callback. | |
| #define | oslSetFrameskip(val) (osl_frameskip = val) |
| Sets the current fixed frameskipping value. | |
| #define | oslSetMaxFrameskip(val) (osl_maxFrameskip = val) |
| Sets the maximum frameskip value. | |
| #define | oslSetVSync(val) (osl_vsyncEnabled = val) |
| Sets the VSync parameter. | |
| #define | oslSyncFrame() oslSyncFrameEx(osl_frameskip, osl_maxFrameskip, osl_vsyncEnabled) |
| Synchronization function to be called at the end of a frame. | |
| #define | oslUncacheData(data, size) sceKernelDcacheWritebackInvalidateRange(data, size); |
| Ensures that the data is no longer in the CPU cache. | |
| #define | oslGetUncachedPtr(adr) ((void*)((int)(adr) | 0x40000000)) |
| Returns a pointer to an uncached address. | |
| #define | oslGetCachedPtr(adr) ((void*)((int)(adr) & (~0x40000000))) |
| Returns a pointer to cached data. | |
| #define | oslAbs(x) (((x) < 0) ? (-(x)) : (x)) |
| Returns the absolute value of a number. | |
| #define | oslMin(x, y) (((x) < (y)) ? (x) : (y)) |
| Returns the smallest value between the two. | |
| #define | oslMax(x, y) (((x) > (y)) ? (x) : (y)) |
| Returns the greatest value between the two. | |
| #define | oslMinMax(x, min, max) ((x) < (max) ? ((x) > (min) ? (x) : (min)) : (max)) |
| Returns a value clamped between a minimum and maximum. | |
| #define | oslNumberof(n) (sizeof(n) / sizeof(*(n))) |
| Returns the number of objects in an array. | |
| #define | oslPrintf(format ...) ({ char __str[1000]; sprintf(__str, ## format); oslConsolePrint(__str); }) |
| Prints formatted text to the current position of the cursor. | |
| #define | oslPrintf_xy(x, y, str, format ...) ({ osl_consolePosX = x; osl_consolePosY = y; oslPrintf(str, ## format); }) |
| Prints formatted text at a specific position on the screen. | |
| #define | oslCls() (oslClearScreen(0), oslMoveTo(0, 0)) |
| Clears the screen (to black) and resets the cursor to the top-left corner of the screen. | |
| #define | oslMoveTo(x, y) (osl_consolePosX = x * osl_sceFont->charWidths['0'], osl_consolePosY = y * osl_sceFont->charHeight) |
| Moves the cursor to a place on the screen. | |
| #define | OSL_BENCH_SLOTS 8 |
| Number of available benchmark slots. | |
| #define | OSL_BENCH_SAMPLES 20 |
| Number of samples used for mean benchmarking. | |
| #define | OSL_UVRAM_BASE ((u8*)0x04000000) |
| Base address of the UVRAM (Uncached Video RAM) on the PSP. | |
| #define | OSL_UVRAM_SIZE (2 << 20) |
| Size of the UVRAM (Uncached Video RAM) in bytes. | |
| #define | OSL_UVRAM_END ((u8*)((u32)OSL_UVRAM_BASE + OSL_UVRAM_SIZE)) |
| End address of the UVRAM (Uncached Video RAM) region. | |
Enumerations | |
| enum | OSL_INITFLAGS { OSL_IF_USEOWNCALLBACKS = 1 , OSL_IF_NOVBLANKIRQ = 2 } |
| Flags for oslInit function. More... | |
| enum | { OSL_BENCH_INIT = 0 , OSL_BENCH_START , OSL_BENCH_END , OSL_BENCH_GET , OSL_BENCH_GET_LAST , OSL_BENCH_DISPLAY } |
| Enumeration for benchmark actions in OSLib. 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. | |
| void | oslEndFrame () |
| Call this function when a frame has ended. | |
| int | oslSyncFrameEx (int frameskip, int max_frameskip, int vsync) |
| Synchronization function with explicit parameters. | |
| void | oslWaitVSync () |
| Waits for the VSync, synchronizing your game. | |
| int | sceDmacMemcpy (void *dest, const void *source, unsigned int size) |
| Copies data using the internal DMAC. | |
| int | sceDmacTryMemcpy (void *dest, const void *source, unsigned int size) |
| Same as sceDmacMemcpy. | |
| void | oslFasterMemset (u64 *dst, u64 *src, u32 length) |
| Does a memset using the 64-bit capabilities of the CPU. | |
| void | oslFlushDataCache () |
| Flushes the whole cache. | |
| void * | memalign (size_t alignment, size_t size) |
| Allocates a memory block, ensuring it is aligned. | |
| OSL_MEMSTATUS | oslGetRamStatus () |
| Gets info about currently available memory in main RAM. | |
| float | oslSin (float angle, float dist) |
| Calculates the sine of an angle in degrees multiplied by a radius. | |
| float | oslCos (float angle, float dist) |
| Calculates the cosine of an angle in degrees multiplied by a radius. | |
| int | oslSini (int angle, int dist) |
| Returns the sine of an angle in degrees (0 to 360) multiplied by an integer radius. | |
| int | oslCosi (int angle, int dist) |
| Returns the cosine of an angle in degrees (0 to 360) multiplied by an integer radius. | |
| int | oslGetNextPower2 (int val) |
| Returns the next (upper) power of two of a number. | |
| void | oslSetupFTrigo () |
| Sets up the floating-point trigonometric tables. | |
| int | oslBenchmarkTestEx (int startend, int slot) |
| Does a benchmark action. | |
| int | oslMeanBenchmarkTestEx (int startend, int slot) |
| Same as oslBenchmarkTestEx but does a mean of 20 samples before returning a value. | |
| void | oslSysBenchmarkDisplay () |
| Displays the system benchmark results on the top-left corner of the screen. | |
| void | oslVblankInterrupt (int sub, void *parg) |
| Handles the VBLANK interrupt. | |
| int | oslShowSplashScreen1 () |
| Displays the first predefined splash screen. | |
| int | oslShowSplashScreen2 () |
| Displays the second predefined splash screen. | |
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. | |
| int | osl_quit |
| Indicates whether the application should exit. | |
| int | osl_standByUnpermitted |
| Controls whether standby mode is permitted. | |
| int(* | osl_powerCallback )(int arg1, int arg2, void *common) |
| Pointer to the power callback function. | |
| int(* | osl_exitCallback )(int arg1, int arg2, void *common) |
| Pointer to the exit callback function. | |
| int | osl_vblInterruptNumber |
| The interrupt number for the VBLANK interrupt. | |
| int | osl_maxFrameskip |
| Maximum allowed frameskip value. | |
| int | osl_vsyncEnabled |
| Indicates whether VSync is enabled. | |
| int | osl_frameskip |
| Current frameskip setting. | |
| volatile int | osl_vblCount |
| Count of VBLANK interrupts. | |
| volatile int | osl_vblCallCount |
| Count of VBLANK interrupt calls. | |
| volatile int | osl_vblankCounterActive |
| Indicates if the VBLANK counter is active. | |
| volatile int | osl_skip |
| Indicates whether the current frame should be skipped. | |
| volatile int | osl_currentFrameRate |
| Current framerate setting. | |
| int | osl_isinus [361] |
| Precomputed sine values for angles from 0 to 360 degrees. | |
| int | osl_icosinus [361] |
| Precomputed cosine values for angles from 0 to 360 degrees. | |
Main Oldschool Library header file.
This header defines the main structures, macros, and functions used in the OldSchool Library (OSLib) framework. OSLib provides a comprehensive set of tools for developing applications on the PSP platform, including graphics, input handling, memory management, and more. This file includes both general utility functions and platform-specific implementations for the PSP.