### Configure, build, and install PSPSDK Source: https://pspdev.github.io/pspsdk/index.html Execute the standard build sequence to compile and install the SDK. ```bash ./configure make make doxygen-doc make install ``` -------------------------------- ### Install psp-sdk-bin via AUR helper Source: https://pspdev.github.io/installation/arch.html Installs the pre-compiled binary package using an AUR helper like yay. ```bash yay -S psp-sdk-bin ``` -------------------------------- ### Load and start module functions Source: https://pspdev.github.io/pspsdk/loadmodule_8c.html Functions for loading and starting modules with or without arguments. ```c SceUID pspSdkLoadStartModuleWithArgs (const char *filename, int mpid, int argc, char *const argv[]) SceUID pspSdkLoadStartModule (const char *filename, int mpid) ``` -------------------------------- ### Install a PSP library Source: https://pspdev.github.io/tips_tricks.html Installs a specific library using the package manager. ```bash psp-pacman -S library ``` -------------------------------- ### sceUtilityOskInitStart Source: https://pspdev.github.io/pspsdk/psputility__osk_8h.html Initializes and starts the on-screen keyboard. ```APIDOC ## int sceUtilityOskInitStart(SceUtilityOskParams *params) ### Description Creates and initializes an on-screen keyboard instance using the provided parameters. ### Parameters - **params** (SceUtilityOskParams*) - Required - Pointer to the OSK configuration parameters. ``` -------------------------------- ### sceUtilityOskInitStart Source: https://pspdev.github.io/pspsdk/psputility__osk_8h.html Initializes and starts the on-screen keyboard. ```APIDOC ## int sceUtilityOskInitStart(SceUtilityOskParams *params) ### Description Create an on-screen keyboard. ### Parameters - **params** (SceUtilityOskParams*) - OSK parameters. ### Returns - **int** - < 0 on error. ``` -------------------------------- ### sceKernelStartModule Source: https://pspdev.github.io/pspsdk/group__ModuleMgr.html Starts a previously loaded module. ```APIDOC ## int sceKernelStartModule(SceUID modid, SceSize argsize, void *argp, int *status, SceKernelSMOption *option) ### Description Starts a loaded module using the provided arguments and options. ### Parameters - **modid** (SceUID) - The UID of the module to start. - **argsize** (SceSize) - Size of the argument buffer. - **argp** (void *) - Pointer to the argument buffer. - **status** (int *) - Pointer to store the module status. - **option** (SceKernelSMOption *) - Pointer to module start options. ``` -------------------------------- ### Install psp-sdk via AUR helper Source: https://pspdev.github.io/installation/arch.html Installs the source-based package using an AUR helper. ```bash yay -S psp-sdk ``` -------------------------------- ### Install SDK Dependencies Source: https://pspdev.github.io/installation/windows.html Install required build tools and libraries for the PSP SDK. ```bash sudo apt-get install build-essential cmake pkgconf libreadline8 libusb-0.1 libgpgme11 libarchive-tools fakeroot wget ``` -------------------------------- ### pspSdkLoadStartModuleWithArgs Source: https://pspdev.github.io/pspsdk/group__PSPSDK.html Loads and starts a module with provided arguments. ```APIDOC ## SceUID pspSdkLoadStartModuleWithArgs(const char *filename, int mpid, int argc, char *const argv[]) ### Description Load a module and start it with arguments. ### Parameters - **filename** (const char *) - Path to the module. - **mpid** (int) - Memory partition ID to use to load the module. - **argc** (int) - Number of arguments to pass to start module. - **argv** (char *const[]) - Array of arguments. ### Returns - The UID of the module on success, otherwise one of PspKernelErrorCodes. ``` -------------------------------- ### gprof_start Source: https://pspdev.github.io/pspsdk/prof_8c.html Starts the application profiler. ```APIDOC ## void gprof_start (void) ### Description Starts the profiler to begin collecting performance data. ### Signature void gprof_start(void) ``` -------------------------------- ### Install dependencies via Homebrew Source: https://pspdev.github.io/installation/macos.html Installs all necessary build tools and libraries required for the PSP SDK. ```bash brew install cmake pkgconf gnu-sed bash openssl libtool libmpc libarchive gettext texinfo bison flex isl gsl gmp mpfr libusb-compat zlib ``` -------------------------------- ### Install SDK dependencies Source: https://pspdev.github.io/installation/debian.html Installs the necessary build tools and libraries required for the PSP SDK. ```bash sudo apt-get install build-essential cmake pkgconf libreadline8 libusb-0.1 libgpgme11 libarchive-tools fakeroot ``` -------------------------------- ### Install WSL on Windows Source: https://pspdev.github.io/installation/windows.html Run this command in an administrator PowerShell window to install WSL. ```powershell wsl --install ``` -------------------------------- ### Video and Hardware Setup Source: https://pspdev.github.io/pspsdk/pspusbcam_8h_source.html Functions to initialize video capture, microphone, and manage camera orientation. ```APIDOC int sceUsbCamSetupVideo(PspUsbCamSetupVideoParam *param, void *workarea, int wasize); int sceUsbCamSetupMic(void *param, void *workarea, int wasize); int sceUsbCamAutoImageReverseSW(int on); int sceUsbCamGetAutoImageReverseState(void); int sceUsbCamGetLensDirection(void); ``` -------------------------------- ### sceUsbStart Source: https://pspdev.github.io/pspsdk/pspusb_8h_source.html Starts a specified USB driver. ```APIDOC ## int sceUsbStart(const char* driverName, int size, void *args) ### Description Starts a USB driver with the specified name and arguments. ### Parameters - **driverName** (const char*) - The name of the driver to start. - **size** (int) - The size of the arguments structure. - **args** (void*) - Pointer to the arguments for the driver. ``` -------------------------------- ### Verify PSP SDK installation Source: https://pspdev.github.io/installation/fedora.html Checks the installation by printing the configured PSPDEV path. ```bash psp-config --pspdev-path ``` -------------------------------- ### Install PSP SDK dependencies Source: https://pspdev.github.io/installation/fedora.html Installs the necessary development tools and libraries required for the PSP SDK using dnf. ```bash sudo dnf -y install @development-tools cmake bsdtar libusb-compat-0.1 gpgme2 fakeroot xz nano ``` -------------------------------- ### gprof_start() Source: https://pspdev.github.io/pspsdk/prof_8c.html Initializes and starts a new profiling session. ```APIDOC ## void gprof_start(void) ### Description Start the profiler. If the profiler is already running, this function stops the previous one and ignores the result, then initializes a new profiler session. ``` -------------------------------- ### Build directory setup for PSP Source: https://pspdev.github.io/tips_tricks.html Initializes a build directory for PSP projects. ```bash mkdir build && cd build ``` -------------------------------- ### sceUsbCamStartVideo Source: https://pspdev.github.io/pspsdk/pspusbcam_8h_source.html Starts the video capture process. ```APIDOC ## int sceUsbCamStartVideo(void) ### Description Starts the video capture process. ``` -------------------------------- ### Manually install psp-sdk Source: https://pspdev.github.io/installation/arch.html Clones the AUR repository and builds the SDK from source manually. ```bash # Clone the build files git clone https://aur.archlinux.org/psp-sdk.git cd psp-sdk # Build and install the package (this will take a while!) makepkg -si # Clean up (optional) cd .. rm -rf psp-sdk ``` -------------------------------- ### pspSdkLoadStartModule Source: https://pspdev.github.io/pspsdk/group__PSPSDK.html Loads and starts a module from the specified file path. ```APIDOC ## SceUID pspSdkLoadStartModule(const char *filename, int mpid) ### Description Load a module and start it. ### Parameters - **filename** (const char *) - Path to the module. - **mpid** (int) - Memory partition ID to use to load the module. ### Returns - The UID of the module on success, otherwise one of PspKernelErrorCodes. ``` -------------------------------- ### Manually install psp-sdk-bin Source: https://pspdev.github.io/installation/arch.html Clones the AUR repository and builds the binary package manually using makepkg. ```bash # Clone the build files git clone https://aur.archlinux.org/psp-sdk-bin.git cd psp-sdk-bin # Build and install the package makepkg -si # Clean up (optional) cd .. rm -rf psp-sdk-bin ``` -------------------------------- ### sceUsbCamStartVideo Source: https://pspdev.github.io/pspsdk/pspusbcam_8h_source.html Starts video input from the camera. ```APIDOC int sceUsbCamStartVideo(void); ``` -------------------------------- ### pspDebugGdbStubInit() Source: https://pspdev.github.io/pspsdk/group__Debug.html Installs the GDB stub handler for remote debugging. ```APIDOC ## void pspDebugGdbStubInit(void) ### Description Install the gdb stub handler. ``` -------------------------------- ### List available PSP libraries Source: https://pspdev.github.io/tips_tricks.html Displays a list of all libraries available for installation. ```bash psp-pacman -Sl ``` -------------------------------- ### pspAudioInit Source: https://pspdev.github.io/pspsdk/pspaudiolib_8c.html Initializes the audio system, reserves channels, and starts the audio processing threads. ```APIDOC ## int pspAudioInit() ### Description Initializes the audio system. This function reserves audio channels, sets default volumes, and creates/starts the necessary kernel threads for audio processing. ``` -------------------------------- ### pspFpuGetCause Source: https://pspdev.github.io/pspsdk/pspfpu_8h_source.html Get the cause bits (only useful if you installed your own exception handler). ```APIDOC ## uint32_t pspFpuGetCause(void) ### Description Get the cause bits (only useful if you installed your own exception handler). ``` -------------------------------- ### Get Adhocctl Parameter Source: https://pspdev.github.io/pspsdk/pspnet__adhocctl_8h_source.html Get Adhocctl parameter. ```c int sceNetAdhocctlGetParameter(struct SceNetAdhocctlParams *params); ``` -------------------------------- ### Initialize build system Source: https://pspdev.github.io/pspsdk/index.html Generate the configure script and support files using autotools. ```bash ./bootstrap ``` -------------------------------- ### Get Scan Results Source: https://pspdev.github.io/pspsdk/pspnet__adhocctl_8h_source.html Get the results of a scan. ```c int sceNetAdhocctlGetScanInfo(int *length, void *buf); ``` -------------------------------- ### Get Peer Info Source: https://pspdev.github.io/pspsdk/pspnet__adhocctl_8h_source.html Get peer information. ```c int sceNetAdhocctlGetPeerInfo(unsigned char *mac, int size, struct SceNetAdhocctlPeerInfo *peerinfo); ``` -------------------------------- ### sceKernelStartThread Source: https://pspdev.github.io/pspsdk/group__ThreadMan.html Starts a previously created thread. ```APIDOC ## sceKernelStartThread ### Description Starts the execution of a created thread. ### Signature int sceKernelStartThread(SceUID thid, SceSize arglen, void *argp) ``` -------------------------------- ### Get Peer List Source: https://pspdev.github.io/pspsdk/pspnet__adhocctl_8h_source.html Get a list of peers. ```c int sceNetAdhocctlGetPeerList(int *length, void *buf); ``` -------------------------------- ### Get Adhoc ID Source: https://pspdev.github.io/pspsdk/pspnet__adhocctl_8h_source.html Get the adhoc ID. ```c int sceNetAdhocctlGetAdhocId(struct productStruct *product); ``` -------------------------------- ### sceNetAdhocMatchingStart Source: https://pspdev.github.io/pspsdk/pspnet__adhocmatching_8h.html Starts a matching object with specified thread priorities and stack sizes. ```APIDOC ## sceNetAdhocMatchingStart ### Description Starts a matching object using the ID returned from sceNetAdhocMatchingCreate. ### Parameters - **matchingid** (int) - The ID returned from sceNetAdhocMatchingCreate - **evthpri** (int) - Priority of the event handler thread - **evthstack** (int) - Stack size of the event handler thread - **inthpri** (int) - Priority of the input handler thread - **inthstack** (int) - Stack size of the input handler thread - **optlen** (int) - Size of hellodata - **optdata** (void *) - Pointer to block of data passed to callback ### Returns - 0 on success, < 0 on error ``` -------------------------------- ### Module Information and Entry Point Source: https://pspdev.github.io/pspsdk/prxexports_8c.html External declarations for module information and the start entry point. ```c struct SceModuleInfo module_info extern int module_start extern ``` -------------------------------- ### Initialize PSPLINK Host Connection Source: https://pspdev.github.io/debugging.html Start the USB host file server on the PC to allow the PSP to communicate with the build directory. ```bash usbhostfs_pc ``` -------------------------------- ### Get Address by Nickname Source: https://pspdev.github.io/pspsdk/pspnet__adhocctl_8h_source.html Get mac address from nickname. ```c int sceNetAdhocctlGetAddrByName(char *nickname, int *length, void *buf); ``` -------------------------------- ### Get Nickname by Address Source: https://pspdev.github.io/pspsdk/pspnet__adhocctl_8h_source.html Get nickname from a mac address. ```c int sceNetAdhocctlGetNameByAddr(unsigned char *mac, char *nickname); ``` -------------------------------- ### Run the PSPDEV container Source: https://pspdev.github.io/installation/docker.html Starts an interactive container with the current directory mounted to /source. ```bash docker run -ti -v $PWD:/source pspdev/pspdev:latest ``` -------------------------------- ### Get Adhoc State Source: https://pspdev.github.io/pspsdk/pspnet__adhocctl_8h_source.html Get the state of the Adhoc control. ```c int sceNetAdhocctlGetState(int *event); ``` -------------------------------- ### Create a Messagebox Source: https://pspdev.github.io/pspsdk/group__ThreadMan.html Example demonstrating the creation of a new messagebox using the sceKernelCreateMbx function. ```c int mbxid; mbxid = sceKernelCreateMbx("MyMessagebox", 0, NULL); ``` -------------------------------- ### Audio Playback with SDL_mixer in C Source: https://pspdev.github.io/basic_programs.html Initializes SDL and SDL_mixer, loads an audio file, and handles playback controls via gamepad input. ```c #include #include #include // Define screen dimensions #define SCREEN_WIDTH 480 #define SCREEN_HEIGHT 272 int main(int argc, char **argv) { // This prevents compiler warnings // We don't actually need these variables, but they do need to be there so SDL_main works (void)argc; (void)argv; // Initialize sdl if(!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_GAMEPAD)) { SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return 1; } // Initialize SDL mixer if(!MIX_Init()) { SDL_Log("Couldn't initialize SDL mixer: %s", SDL_GetError()); SDL_Quit(); return 2; } // Initialise audio device MIX_Mixer * mixer = MIX_CreateMixerDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, NULL); if (!mixer) { SDL_Log("Couldn't open default audio device: %s", SDL_GetError()); MIX_Quit(); SDL_Quit(); return 3; } // Initialize channel to play music on, called a track in SDL mixer MIX_Track * music_track = MIX_CreateTrack(mixer); if (!music_track) { SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); MIX_DestroyMixer(mixer); MIX_Quit(); SDL_Quit(); return 3; } SDL_Window * window = NULL; SDL_Renderer * renderer = NULL; if (!SDL_CreateWindowAndRenderer("window", 480, 272, 0, &window, &renderer)) { SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); MIX_DestroyMixer(mixer); MIX_Quit(); SDL_Quit(); return 4; } // Load ogg file MIX_Audio *ogg_file = MIX_LoadAudio(mixer, "test.ogg", false); if (!ogg_file) { SDL_Log("Couldn't load audio file: %s", SDL_GetError()); SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window); MIX_DestroyMixer(mixer); MIX_Quit(); SDL_Quit(); return 5; } SDL_FRect rect; // Square dimensions: Half of the min(SCREEN_WIDTH, SCREEN_HEIGHT) rect.w = SDL_min(SCREEN_WIDTH, SCREEN_HEIGHT) / 2.0f; rect.h = SDL_min(SCREEN_WIDTH, SCREEN_HEIGHT) / 2.0f; // Square position: In the middle of the screen rect.x = SCREEN_WIDTH / 2 - rect.w / 2; rect.y = SCREEN_HEIGHT / 2 - rect.h / 2; // Declare rects of pause symbol SDL_FRect pause_rect1, pause_rect2; pause_rect1.h = rect.h / 2.0f; pause_rect1.w = 40.0f; pause_rect1.x = rect.x + (rect.w - pause_rect1.w * 3.0f) / 2.0f; pause_rect1.y = rect.y + rect.h / 4.0f; pause_rect2 = pause_rect1; pause_rect2.x += pause_rect1.w * 2.0f; // play the music 8 times MIX_SetTrackAudio(music_track, ogg_file); MIX_SetTrackGain(music_track, 1.0f); if (!MIX_PlayTrack(music_track, 8)) { SDL_Log("Couldn't play audio: %s", SDL_GetError()); MIX_DestroyAudio(ogg_file); SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window); MIX_DestroyMixer(mixer); MIX_Quit(); SDL_Quit(); return 6; } int running = 1; SDL_Event e; while (running) { if(SDL_PollEvent(&e)) { switch(e.type) { case SDL_EVENT_QUIT: running = 0; break; case SDL_EVENT_GAMEPAD_ADDED: SDL_OpenGamepad(e.cdevice.which); break; case SDL_EVENT_GAMEPAD_BUTTON_DOWN: // pause using cross button if (e.gbutton.button == SDL_GAMEPAD_BUTTON_SOUTH) { MIX_PauseTrack(music_track); // resume using circle button } else if (e.gbutton.button == SDL_GAMEPAD_BUTTON_EAST) { MIX_ResumeTrack(music_track); // press start button to exit } else if (e.gbutton.button == SDL_GAMEPAD_BUTTON_START) { running = 0; } break; } } // Initialize renderer color black for the background SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0); // Clear screen SDL_RenderClear(renderer); // Set renderer color green to draw the square SDL_SetRenderDrawColor(renderer, 0, 0xFF, 0, 0xFF); // Draw filled square SDL_RenderFillRect(renderer, &rect); // Check pause status if(!MIX_TrackPlaying(music_track)) { // Set renderer color black to draw the pause symbol SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0); ``` -------------------------------- ### Get Game Mode Info Source: https://pspdev.github.io/pspsdk/pspnet__adhocctl_8h_source.html Get game mode information. ```c int sceNetAdhocctlGetGameModeInfo(struct SceNetAdhocctlGameModeInfo *gamemodeinfo); ``` -------------------------------- ### sceKernelApplicationType Source: https://pspdev.github.io/pspsdk/pspinit_8h.html Retrieves the key configuration in which the system has booted. ```APIDOC ## int sceKernelApplicationType() ### Description Get the key configuration in which the system has booted. ### Returns - **int** - The application type configuration. ``` -------------------------------- ### Complete Makefile for PRX Module Source: https://pspdev.github.io/techniques/prx_modules.html A full example of a Makefile configured for a PRX module build. ```makefile TARGET = SamplePlugin OBJS = main.o CFLAGS = -O2 -Wall LDFLAGS = -nostartfiles BUILD_PRX = 1 PRX_EXPORTS = exports.exp PSPSDK=$(shell psp-config --pspsdk-path) include $(PSPSDK)/lib/build.mak ``` -------------------------------- ### pspDebugSioInstallKprintf Source: https://pspdev.github.io/pspsdk/group__Debug.html Installs a kprintf debug putchar handler. ```APIDOC ## void pspDebugSioInstallKprintf(void) ### Description Installs a handler for kprintf output. This function implicitly calls pspDebugEnablePutchar. The SIO port must be initialized before calling this function. ``` -------------------------------- ### Macros starting with Z Source: https://pspdev.github.io/pspsdk/globals_defs_z.html List of macros starting with Z and their corresponding files. ```APIDOC ## Macros (Z) - **zero** - Defined in: `as_reg_compat.h` - **ZV** - Defined in: `sceGuInit.c` ``` -------------------------------- ### Register a UMD callback Source: https://pspdev.github.io/pspsdk/group__UMD.html Example showing how to define a callback function and register it with the UMD system. ```c int umd_callback(int unknown, int event) { //do something } int cbid = sceKernelCreateCallback("UMD Callback", umd_callback, NULL); sceUmdRegisterUMDCallBack(cbid); ``` -------------------------------- ### SDL3 Window and Renderer Initialization Source: https://pspdev.github.io/basic_programs.html Initializes SDL3, creates a window and renderer, and runs a main loop to draw a red square. ```c #include #include int main(int argc, char *argv[]) { // This prevents compiler warnings // We don't actually need these variables, but they do need to be there so SDL_main works (void)argc; (void)argv; // Initialize sdl if(!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMEPAD)) { SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return 1; } SDL_Window * window = NULL; SDL_Renderer * renderer = NULL; if (!SDL_CreateWindowAndRenderer("window", 480, 272, 0, &window, &renderer)) { SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); SDL_Quit(); return 2; } SDL_FRect square = {216, 96, 34, 64}; int running = 1; SDL_Event event; while (running) { // Process input if (SDL_PollEvent(&event)) { switch (event.type) { case SDL_EVENT_QUIT: // End the loop if the programs is being closed running = 0; break; case SDL_EVENT_GAMEPAD_ADDED: // Connect a controller when it is connected SDL_OpenGamepad(event.cdevice.which); break; case SDL_EVENT_GAMEPAD_BUTTON_DOWN: if(event.gbutton.button == SDL_GAMEPAD_BUTTON_START) { // Close the program if start is pressed running = 0; } break; } } // Clear the screen SDL_RenderClear(renderer); // Draw a red square SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255); SDL_RenderFillRect(renderer, &square); // Draw everything on a white background SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); SDL_RenderPresent(renderer); } SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window); SDL_Quit(); return 0; } ``` -------------------------------- ### sceHttpInit Source: https://pspdev.github.io/pspsdk/psphttp_8h_source.html Initializes the HTTP library. ```APIDOC ## int sceHttpInit(unsigned int unknown1) ### Description Initializes the HTTP library for use. ### Parameters - **unknown1** (unsigned int) - Required - Unknown parameter. ``` -------------------------------- ### sceHttpsInit() Source: https://pspdev.github.io/pspsdk/psphttp_8h.html Initializes the https library. ```APIDOC ## sceHttpsInit() ### Description Initializes the https library. ### Parameters - **unknown1** (int) - Required - Pass 0 - **unknown2** (int) - Required - Pass 0 - **unknown3** (int) - Required - Pass 0 - **unknown4** (int) - Required - Pass 0 ### Returns 0 on success, < 0 on error. ``` -------------------------------- ### sceUsbCamSetupStillEx Source: https://pspdev.github.io/pspsdk/pspusbcam_8h_source.html Setups the parameters to take a still image with extended options. ```APIDOC int sceUsbCamSetupStillEx(PspUsbCamSetupStillExParam *param); ``` -------------------------------- ### Secure Install ID Length Macro Source: https://pspdev.github.io/pspsdk/group__ModuleMgr.html Macro defining the length of the secure install ID. ```c #define SCE_SECURE_INSTALL_ID_LEN (16) ``` -------------------------------- ### Profiler Output Example Source: https://pspdev.github.io/debugging.html Sample output showing function execution time and call counts. ```text Each sample counts as 0.001 seconds. % cumulative self self total time seconds seconds calls ms/call ms/call name 95.98 0.17 0.17 104728 0.00 0.00 is_prime 4.02 0.17 0.01 1 7.00 7.00 dummy_function 0.00 0.17 0.00 1 0.00 174.00 main 0.00 0.17 0.00 1 0.00 167.00 sum_of_square_roots ``` -------------------------------- ### Install a specific package Source: https://pspdev.github.io/psp-packages/index.html Use this command to install a package that is not part of the default psp-libraries group. ```bash # psp-pacman -Sy package-name ``` -------------------------------- ### sceUtilityNetconfInitStart Source: https://pspdev.github.io/pspsdk/psputility__netconf_8h_source.html Initializes the Network Configuration Dialog Utility. ```APIDOC ## int sceUtilityNetconfInitStart(pspUtilityNetconfData *data) ### Description Initializes the Network Configuration Dialog Utility using the provided configuration data structure. ### Parameters - **data** (pspUtilityNetconfData*) - Required - Pointer to the configuration data structure containing action and connection parameters. ``` -------------------------------- ### pspDebugInstallStdinHandler Source: https://pspdev.github.io/pspsdk/group__Debug.html Installs a handler for stdin, enabling the use of standard stdio functions for input. ```APIDOC ## int pspDebugInstallStdinHandler(PspDebugInputHandler handler) ### Description Install a handler for stdin (so you can use normal stdio functions). ### Parameters - **handler** (PspDebugInputHandler) - Required - A pointer to input handler, NULL to disable. ### Returns - **int** - < 0 on error, else 0. ``` -------------------------------- ### pspAudioInit Source: https://pspdev.github.io/pspsdk/pspaudiolib_8h_source.html Initializes the audio library. ```APIDOC ## int pspAudioInit() ### Description Initializes the audio library for use. ### Returns - **int** - Returns 0 on success, or an error code. ``` -------------------------------- ### Typedefs starting with G Source: https://pspdev.github.io/pspsdk/globals_type_g.html A list of typedefs starting with the letter G and their corresponding header files. ```APIDOC ## Typedefs ### GECommand - **Header**: guInternal.h ### GuCallback - **Header**: guInternal.h ### GuSwapBuffersCallback - **Header**: pspgu.h ``` -------------------------------- ### pspAudioInit Source: https://pspdev.github.io/pspsdk/pspaudiolib_8h.html Initializes the audio library. ```APIDOC ## int pspAudioInit() ### Description Initializes the audio library for use. ``` -------------------------------- ### pspDebugScreenInit Source: https://pspdev.github.io/pspsdk/group__Debug.html Initializes the debug screen for output. ```APIDOC ## void pspDebugScreenInit(void) ### Description Initialise the debug screen. ``` -------------------------------- ### psp-gdb Initialization Output Source: https://pspdev.github.io/debugging.html Initial output displayed when starting psp-gdb with the target binary. ```text Reading symbols from ... (gdb) ``` -------------------------------- ### sceGuInit Source: https://pspdev.github.io/pspsdk/pspgu_8h_source.html Initializes the GU system. ```APIDOC ## int sceGuInit(void) ### Description Initializes the GU system. ### Returns - **int** - Status code of the initialization. ``` -------------------------------- ### sceUsbCamGetSharpness Source: https://pspdev.github.io/pspsdk/pspusbcam_8h.html Gets the current sharpness. ```APIDOC ## int sceUsbCamGetSharpness(int *sharpness) ### Description Gets the current sharpness. ### Parameters - **sharpness** (int *) - Pointer to a variable that receives the current sharpness. ### Returns 0 on success, < 0 on error. ``` -------------------------------- ### sceUsbCamGetSaturation Source: https://pspdev.github.io/pspsdk/pspusbcam_8h.html Gets the current saturation. ```APIDOC ## int sceUsbCamGetSaturation(int *saturation) ### Description Gets the current saturation. ### Parameters - **saturation** (int *) - Pointer to a variable that receives the current saturation. ### Returns 0 on success, < 0 on error. ``` -------------------------------- ### sceMpegInit Source: https://pspdev.github.io/pspsdk/pspmpeg_8h_source.html Initializes the MPEG library. ```APIDOC ## SceInt32 sceMpegInit() ### Description Initializes the MPEG library for use. ### Returns - **SceInt32** - Returns 0 on success, or an error code. ``` -------------------------------- ### sceUsbCamGetBrightness Source: https://pspdev.github.io/pspsdk/pspusbcam_8h_source.html Gets the current brightness. ```APIDOC int sceUsbCamGetBrightness(int *brightness); ``` -------------------------------- ### sceKernelBootFrom Source: https://pspdev.github.io/pspsdk/pspinit_8h_source.html Determines the boot medium or source. ```APIDOC ## int sceKernelBootFrom() ### Description Queries the system to determine the source medium from which the system booted. ### Returns - **int** - The boot source identifier. ``` -------------------------------- ### sceGeEdramGetSize Source: https://pspdev.github.io/pspsdk/pspge_8h.html Get the size of VRAM. ```APIDOC ## unsigned int sceGeEdramGetSize (void) ### Description Get the size of VRAM. ``` -------------------------------- ### sceKernelGetThreadKTLS Source: https://pspdev.github.io/pspsdk/group__ThreadmanKern.html Get the KTLS of a thread. ```APIDOC ## void * sceKernelGetThreadKTLS (int id, SceUID thid, int mode) ### Description Get the KTLS of a thread. ### Parameters - **id** (int) - KTLS ID - **thid** (SceUID) - Thread ID - **mode** (int) - Access mode ### Returns - **void*** - Pointer to KTLS ``` -------------------------------- ### sceIoGetstat Source: https://pspdev.github.io/pspsdk/group__FileIO.html Get the status of a file. ```APIDOC ## int sceIoGetstat(const char *file, SceIoStat *stat) ### Description Get the status of a file. ### Parameters - **file** (const char*) - The path to the file. - **stat** (SceIoStat*) - A pointer to an io_stat_t structure. ### Returns - < 0 on error. ``` -------------------------------- ### sceKernelAllocateKTLS Source: https://pspdev.github.io/pspsdk/group__ThreadmanKern.html Setup the KTLS allocator. ```APIDOC ## int sceKernelAllocateKTLS (int id, int(*cb)(unsigned int *size, void *arg), void *arg) ### Description Setup the KTLS allocator. ### Parameters - **id** (int) - KTLS ID - **cb** (int(*)(unsigned int *, void *)) - Allocator callback - **arg** (void *) - Callback argument ### Returns - **int** - Status code ``` -------------------------------- ### sceNetInit Source: https://pspdev.github.io/pspsdk/pspnet_8h.html Initializes the networking library. ```APIDOC ## int sceNetInit(int poolsize, int calloutprio, int calloutstack, int netintrprio, int netintrstack) ### Description Initialise the networking library. ### Parameters - **poolsize** (int) - Size of the memory pool. - **calloutprio** (int) - Priority for callout. - **calloutstack** (int) - Stack size for callout. - **netintrprio** (int) - Priority for network interrupt. - **netintrstack** (int) - Stack size for network interrupt. ``` -------------------------------- ### sceUsbCamGetReverseMode Source: https://pspdev.github.io/pspsdk/pspusbcam_8h.html Gets the current reverse mode. ```APIDOC ## int sceUsbCamGetReverseMode(int *reverseflags) ### Description Gets the current reverse mode. ### Parameters - **reverseflags** (int *) - Pointer to a variable that receives the current reverse mode flags. ### Returns 0 on success, < 0 on error. ``` -------------------------------- ### sceAudioInputInit Source: https://pspdev.github.io/pspsdk/pspaudio_8h.html Initializes audio input. ```APIDOC ## int sceAudioInputInit(int unknown1, int gain, int unknown2) ### Description Init audio input. ### Parameters - **unknown1** (int) - Unknown. Pass 0. - **gain** (int) - Gain. - **unknown2** (int) - Unknown. Pass 0. ### Returns - 0 on success, an error if less than 0. ``` -------------------------------- ### connect() Source: https://pspdev.github.io/pspsdk/globals_func_c.html Establishes a socket connection. ```APIDOC ### connect() **Defined in:** socket.h ``` -------------------------------- ### sceUsbCamGetReadVideoFrameSize Source: https://pspdev.github.io/pspsdk/pspusbcam_8h_source.html Gets the size of the acquired frame. ```APIDOC int sceUsbCamGetReadVideoFrameSize(void); ``` -------------------------------- ### Reassign flash0 device Source: https://pspdev.github.io/pspsdk/group__FileIO.html Example demonstrating how to unassign and reassign the flash0 device with read/write permissions. ```c sceIoUnassign("flash0"); sceIoAssign("flash0", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0); ``` -------------------------------- ### pspDebugSioInit Source: https://pspdev.github.io/pspsdk/pspdebug_8h_source.html Initializes the Serial I/O interface. ```APIDOC ## void pspDebugSioInit(void) ### Description Initializes the SIO (Serial I/O) hardware for debugging communication. ``` -------------------------------- ### sceUsbCamGetAutoImageReverseState Source: https://pspdev.github.io/pspsdk/pspusbcam_8h_source.html Gets the state of the autoreversal of the image. ```APIDOC int sceUsbCamGetAutoImageReverseState(void); ``` -------------------------------- ### sceKernelReferEventFlagStatus Source: https://pspdev.github.io/pspsdk/group__ThreadMan.html Get the status of an event flag. ```APIDOC ## sceKernelReferEventFlagStatus ### Description Get the status of an event flag. ### Parameters - **event** (SceUID) - The UID of the event. - **status** (SceKernelEventFlagInfo *) - A pointer to a SceKernelEventFlagInfo structure. ### Returns < 0 on error. ``` -------------------------------- ### sceKernelReferCallbackStatus Source: https://pspdev.github.io/pspsdk/group__ThreadMan.html Gets the status of a specified callback. ```APIDOC ## sceKernelReferCallbackStatus ### Description Gets the status of a specified callback. ### Parameters - **cb** (SceUID) - The UID of the callback to refer. - **status** (SceKernelCallbackInfo *) - Pointer to a status structure. The size parameter should be initialised before calling. ### Returns < 0 on error. ``` -------------------------------- ### sceImposeGetUMDPopup Source: https://pspdev.github.io/pspsdk/pspimpose__driver_8h.html Get the value of the UMD popup. ```APIDOC ## int sceImposeGetUMDPopup(void) ### Description Retrieves the current status of the UMD popup setting. ``` -------------------------------- ### pspFpuGetRoundmode Source: https://pspdev.github.io/pspsdk/pspfpu_8h_source.html Get the current round mode. ```APIDOC ## enum PspFpuRoundMode pspFpuGetRoundmode(void) ### Description Get the current round mode. ``` -------------------------------- ### Initialize and use Mersenne Twister Source: https://pspdev.github.io/pspsdk/group__Utils.html Example showing how to initialize a Mersenne Twister context and generate a random number. ```c SceKernelUtilsMt19937Context ctx; sceKernelUtilsMt19937Init(&ctx, time(NULL)); u23 rand_val = sceKernelUtilsMt19937UInt(&ctx); ``` -------------------------------- ### pspFpuGetEnable Source: https://pspdev.github.io/pspsdk/pspfpu_8h_source.html Get the exception enable flags. ```APIDOC ## uint32_t pspFpuGetEnable(void) ### Description Get the exception enable flags. ``` -------------------------------- ### Read Controller Data Example Source: https://pspdev.github.io/pspsdk/group__Ctrl.html Demonstrates how to configure the controller sampling and read the current state into a SceCtrlData structure. ```c SceCtrlData pad; sceCtrlSetSamplingCycle(0); sceCtrlSetSamplingMode(1); sceCtrlReadBufferPositive(&pad, 1); // Do something with the read controller data ``` -------------------------------- ### sceKernelGetKTLS Source: https://pspdev.github.io/pspsdk/group__ThreadmanKern.html Get the KTLS of the current thread. ```APIDOC ## void * sceKernelGetKTLS (int id) ### Description Get the KTLS of the current thread. ### Parameters - **id** (int) - KTLS ID ### Returns - **void*** - Pointer to KTLS ``` -------------------------------- ### sceKernelGetSystemStatusFlag Source: https://pspdev.github.io/pspsdk/group__ThreadmanKern.html Get the system status flag. ```APIDOC ## unsigned int sceKernelGetSystemStatusFlag (void) ### Description Get the system status flag. ### Returns - **unsigned int** - System status flag ``` -------------------------------- ### gumInit Source: https://pspdev.github.io/pspsdk/pspgum_8h.html Initializes the pspgum library. ```APIDOC void gumInit(void) ``` -------------------------------- ### sceMp3Init Source: https://pspdev.github.io/pspsdk/pspmp3_8h.html Initializes the MP3 decoder with a specific handle. ```APIDOC ## SceInt32 sceMp3Init(SceInt32 handle) ### Description Initializes the MP3 decoder using the provided handle. ### Parameters - **handle** (SceInt32) - The sceMp3 handle. ### Returns - **SceInt32** - 0 if success, < 0 on error. ``` -------------------------------- ### Implement Hello World in C for PSP Source: https://pspdev.github.io/how_to_use.html This C code initializes the PSP debug screen and sets up exit callbacks to ensure the application can be closed properly. ```c #include #include #include // PSP_MODULE_INFO is required PSP_MODULE_INFO("Hello World", 0, 1, 0); PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER); int exit_callback(int arg1, int arg2, void *common) { sceKernelExitGame(); return 0; } int callback_thread(SceSize args, void *argp) { int cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL); sceKernelRegisterExitCallback(cbid); sceKernelSleepThreadCB(); return 0; } int setup_callbacks(void) { int thid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, 0); if(thid >= 0) sceKernelStartThread(thid, 0, 0); return thid; } int main(void) { // Use above functions to make exiting possible setup_callbacks(); // Print Hello World! on a debug screen on a loop pspDebugScreenInit(); while(1) { pspDebugScreenSetXY(0, 0); pspDebugScreenPrintf("Hello World!"); sceDisplayWaitVblankStart(); } return 0; } ``` -------------------------------- ### sceSTimerStartCount Source: https://pspdev.github.io/pspsdk/pspsystimer_8h_source.html Starts the SysTimer timer count. ```APIDOC ## void sceSTimerStartCount(SceSysTimerId timer) ### Description Starts the SysTimer timer count. ### Parameters - **timer** (SceSysTimerId) - The ID of the timer to start. ``` -------------------------------- ### __fdman_init Source: https://pspdev.github.io/pspsdk/fdman_8h.html Initializes the file descriptor management system. ```APIDOC ## void __fdman_init() ### Description Initializes the internal file descriptor management structures. ``` -------------------------------- ### sceGuStart Source: https://pspdev.github.io/pspsdk/pspgu_8h_source.html Starts filling a new display-context. ```APIDOC ## int sceGuStart(int ctype, void *list) ### Description Initializes a new display-context for filling. ### Parameters - **ctype** (int) - Context type. - **list** (void *) - Pointer to the display list buffer. ``` -------------------------------- ### sceMp3InitResource Source: https://pspdev.github.io/pspsdk/pspmp3_8h.html Initializes the MP3 library resources. ```APIDOC ## SceInt32 sceMp3InitResource() ### Description Initializes the necessary resources for the MP3 library. ### Returns - **SceInt32** - 0 if success, < 0 on error. ``` -------------------------------- ### getsockname() Source: https://pspdev.github.io/pspsdk/socket_8h.html Gets the current address to which the socket is bound. ```APIDOC int getsockname(int __, struct sockaddr * __restrict__, socklen_t * __restrict__) ``` -------------------------------- ### getpeername() Source: https://pspdev.github.io/pspsdk/socket_8h.html Gets the address of the peer connected to the socket. ```APIDOC int getpeername(int __, struct sockaddr * __restrict__, socklen_t * __restrict__) ``` -------------------------------- ### sceUsbCamStillGetInputLength Source: https://pspdev.github.io/pspsdk/pspusbcam_8h.html Gets the size of the acquired still image. ```APIDOC ## int sceUsbCamStillGetInputLength(void) ### Description Retrieves the size of the acquired still image. ### Returns The size of the acquired image on success, < 0 on error. ``` -------------------------------- ### pspvfpu_initcontext Source: https://pspdev.github.io/pspsdk/pspvfpu_8h_source.html Initializes and returns a new VFPU context for use. ```APIDOC ## pspvfpu_initcontext ### Description Prepares the system to use the VFPU by initializing a new context. ### Signature `struct pspvfpu_context *pspvfpu_initcontext(void);` ### Returns - **struct pspvfpu_context*** - A pointer to the initialized VFPU context. ``` -------------------------------- ### Main Application Logic for SDL_ttf Source: https://pspdev.github.io/basic_programs.html Initializes SDL and SDL_ttf, loads a font file, renders text to a surface, and enters a loop to display the texture. ```c #include #include #include // Define screen dimensions #define SCREEN_WIDTH 480 #define SCREEN_HEIGHT 272 int main(int argc, char **argv) { // This prevents compiler warnings // We don't actually need these variables, but they do need to be there so SDL_main works (void)argc; (void)argv; // Initialize sdl if(!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMEPAD)) { SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return 1; } // Initialize SDL ttf if (!TTF_Init()) { SDL_Log("Couldn't initialize SDL ttf: %s", SDL_GetError()); SDL_Quit(); return 2; } SDL_Window * window = NULL; SDL_Renderer * renderer = NULL; if (!SDL_CreateWindowAndRenderer("window", 480, 272, 0, &window, &renderer)) { SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); SDL_Quit(); return 3; } // Load the font file, make sure it is in the directory the eboot file is in TTF_Font *font = TTF_OpenFont("Pacifico.ttf", 40); if (!font) { SDL_Log("Couldn't load font: %s", SDL_GetError()); SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window); TTF_Quit(); SDL_Quit(); return 4; } // Set the text and background color SDL_Color text_color = {0x00, 0x00, 0x00, 0xff}; SDL_Color bg_color = {0xff, 0xff, 0xff, 0xff}; // Create a texture using a string and SDL ttf const char * text = "Hello World!"; SDL_FRect text_rect = {0, 0, 0, 0}; SDL_Surface *surface = TTF_RenderText_Solid(font, text, SDL_strlen(text), text_color); if (!surface) { SDL_Log("Couldn't render text: %s", SDL_GetError()); SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window); TTF_Quit(); SDL_Quit(); return 5; } SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, surface); // Get text dimensions text_rect.w = (float) surface->w; text_rect.h = (float) surface->h; SDL_DestroySurface(surface); text_rect.x = (SCREEN_WIDTH - text_rect.w) / 2.0f; text_rect.y = text_rect.h + 30.0f; int running = 1; SDL_Event e; while (running) { if (SDL_PollEvent(&e)) { switch (e.type) { case SDL_EVENT_QUIT: // Event that is passed when the user closes the program running = 0; break; case SDL_EVENT_GAMEPAD_ADDED: // Activate any gamepad that is connected SDL_OpenGamepad(e.cdevice.which); break; case SDL_EVENT_GAMEPAD_BUTTON_DOWN: if (e.gbutton.button == SDL_GAMEPAD_BUTTON_START) { running = 0; } break; } } // Refresh the screen and redraw the text every frame SDL_SetRenderDrawColor(renderer, bg_color.r, bg_color.g, bg_color.b, bg_color.a); SDL_RenderClear(renderer); SDL_RenderTexture(renderer, texture, NULL, &text_rect); SDL_RenderPresent(renderer); } // Clean up SDL_DestroyTexture(texture); SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window); TTF_Quit(); SDL_Quit(); return 0; } ``` -------------------------------- ### sceUsbCamGetZoom Source: https://pspdev.github.io/pspsdk/pspusbcam_8h.html Gets the current camera zoom level. ```APIDOC ## int sceUsbCamGetZoom(int *zoom) ### Description Gets the current zoom. ``` -------------------------------- ### main() Source: https://pspdev.github.io/pspsdk/globals_func_m.html The main entry point function for the application. ```APIDOC ## main() ### Description The main entry point function for the application. It is defined in callstack.c, crt0.c, and crt0_prx.c. ``` -------------------------------- ### sceUsbCamGetEvLevel Source: https://pspdev.github.io/pspsdk/pspusbcam_8h_source.html Gets the current exposure level of the camera. ```APIDOC int sceUsbCamGetEvLevel(int *ev); ``` -------------------------------- ### sceSTimerGetCount Source: https://pspdev.github.io/pspsdk/pspsystimer_8h_source.html Gets the current SysTimer timer count. ```APIDOC ## void sceSTimerGetCount(SceSysTimerId timer, int* count) ### Description Gets the current SysTimer timer count. ### Parameters - **timer** (SceSysTimerId) - The ID of the timer. - **count** (int*) - Pointer to store the current count. ``` -------------------------------- ### sceNetInetGetpeername Source: https://pspdev.github.io/pspsdk/pspnet__inet_8h.html Gets the address of the peer connected to the socket. ```APIDOC ## int sceNetInetGetpeername(int s, struct sockaddr *name, socklen_t *namelen) ### Description Returns the address of the peer connected to the socket s, in the buffer pointed to by name. ``` -------------------------------- ### pspDebugSioInit Source: https://pspdev.github.io/pspsdk/group__Debug.html Initializes the remote SIO port with default settings (4800 8N1). ```APIDOC ## void pspDebugSioInit(void) ### Description Initializes the remote SIO port. Note that this function will delay for 2 seconds to allow power to stabilize. ``` -------------------------------- ### pspFpuGetFS Source: https://pspdev.github.io/pspsdk/pspfpu_8h_source.html Get the current value of the FS bit. ```APIDOC ## uint32_t pspFpuGetFS(void) ### Description Get the current value of the FS bit. ``` -------------------------------- ### pspFpuGetCondbits Source: https://pspdev.github.io/pspsdk/pspfpu_8h_source.html Get the condition flags (8 bits). ```APIDOC ## uint32_t pspFpuGetCondbits(void) ### Description Get the condition flags (8 bits). ``` -------------------------------- ### sceNetAdhocctlInit Source: https://pspdev.github.io/pspsdk/pspnet__adhocctl_8h_source.html Initializes the Adhoc control library. ```APIDOC ## int sceNetAdhocctlInit(int stacksize, int priority, struct productStruct *product) ### Description Initializes the Adhoc control library for use in the application. ### Parameters - **stacksize** (int) - The stack size for the library thread. - **priority** (int) - The priority for the library thread. - **product** (struct productStruct*) - Pointer to the product structure. ``` -------------------------------- ### __sceSasGetGrain Source: https://pspdev.github.io/pspsdk/group__SAS.html Gets the grain size of the SceSasCore instance. ```APIDOC ## int __sceSasGetGrain(SceSasCore *core) ### Description Gets the grain size of the SceSasCore instance. ### Parameters - **core** (SceSasCore*) - Pointer to a valid sceSas instance. ### Returns - (int) The grain size on success, an error code if less than 0. ```