From 082f66688c324ae17b26cd4b4c5c8147649fec29 Mon Sep 17 00:00:00 2001 From: djdiskmachine <110535302+djdiskmachine@users.noreply.github.com> Date: Fri, 6 Jan 2023 10:45:27 +0100 Subject: [PATCH] PSP build working again (#8) * Uplift psp build * Cleaned up libs * Fixed Windows-style case sensitive path error *grumble* * Updated pspdev path in Makefile.PSP * Removed unused PSP files * Updated BUILD_HOWTO.txt to README.md Requires this release of pspdev, all later builds are breaking https://github.com/pspdev/pspdev/releases/download/v20200623/pspdev-ubuntu-latest.tar.gz --- projects/BUILD_HOW_TO.txt | 16 - projects/Makefile.PSP | 11 +- projects/README.md | 26 + .../Adapters/PSP/FileSystem/PSPFileSystem.cpp | 2 +- sources/Adapters/PSP/FileSystem/dirlist.cpp | 61 --- sources/Adapters/PSP/FileSystem/pspFileIO.cpp | 447 ---------------- .../Adapters/PSP/FileSystem/pspiofilemgr.h | 477 ------------------ sources/Application/Model/Project.h | 4 +- sources/System/Console/Trace.cpp | 2 +- 9 files changed, 34 insertions(+), 1012 deletions(-) delete mode 100644 projects/BUILD_HOW_TO.txt create mode 100644 projects/README.md delete mode 100644 sources/Adapters/PSP/FileSystem/dirlist.cpp delete mode 100644 sources/Adapters/PSP/FileSystem/pspFileIO.cpp delete mode 100644 sources/Adapters/PSP/FileSystem/pspiofilemgr.h diff --git a/projects/BUILD_HOW_TO.txt b/projects/BUILD_HOW_TO.txt deleted file mode 100644 index ada9a210..00000000 --- a/projects/BUILD_HOW_TO.txt +++ /dev/null @@ -1,16 +0,0 @@ -Windows: Use Visual 2008 express edition + will need the DirectX SDK (I'm using March 2008) - -Mac: Use Xcode 3.x + will need the SDL Framework installed - -CAANOO: Compile under linux with the caanoo toolchain - -GP2X: Compile under minsys - -PSP: Compile under minsys - -DINGOO: Compile under Linux - -RASPI: Compile under Linux - Required libs: - sudo apt install -y git gcc libsdl1.2-dev make g++ libjack-dev - diff --git a/projects/Makefile.PSP b/projects/Makefile.PSP index c66b51db..b47c7482 100644 --- a/projects/Makefile.PSP +++ b/projects/Makefile.PSP @@ -1,16 +1,14 @@ - -PATH=$PATH:/c/devkitpro/devkitPSP/bin - TARGET = lgpt EXTRA_TARGETS = EBOOT.PBP PSP_EBOOT_TITLE = LittleGPTracker PSP_EBOOT_ICON = $(PWD)/psp_icon.png +PSP_EBOOT_ICON1 = $(PWD)/lgpt_icon.bmp PSP_EBOOT_PIC1 = $(PWD)/psp_bg.png include $(PWD)/psp_rules -PSPSDK=$(shell /c/devkitpro/devkitPSP/bin/psp-config --pspsdk-path) +PSPSDK=$(shell $(PSPDEV)/bin/psp-config --pspsdk-path) PSPBIN = $(PSPSDK)/../bin CFLAGS := -O3 -G0 -Wall -DPLATFORM_$(PLATFORM) -DNDEBUG -DCPP_MEMORY -I$(PWD)/../sources -I$(PSPSDK)/include @@ -19,6 +17,5 @@ CXXFLAGS:= $(CFLAGS) -fexceptions -fno-rtti EXTENSION:= elf -LIBS = -L/usr/local/pspsdk/lib -lSDL_image -lpng -lz -lstdc++ -LIBS += -lSDL -lGL -lglu -lglut -lpspvfpu -lm -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpspnet_inet -ljpeg - +LIBS = -L$(PSPDEV)/psp/lib -lSDL_image -lpng -lz -lstdc++ -lSDL -lGL -lGLU -lglut -lm -lc -ljpeg +LIBS += -lpspvfpu -lpspgu -lpsphprm -lpsprtc -lpspaudio -lpspirkeyb -lpsppower diff --git a/projects/README.md b/projects/README.md new file mode 100644 index 00000000..6eb6d535 --- /dev/null +++ b/projects/README.md @@ -0,0 +1,26 @@ +##### Windows: Use Visual 2008 express edition + will need the DirectX SDK (I'm using March 2008) + +##### Mac: Use Xcode 3.x + will need the SDL Framework installed + +##### CAANOO: Compile under linux with the caanoo toolchain + +##### GP2X: Compile under minsys + +##### PSP: Compile under Ubuntu + Required libs: + sudo apt install -y build-essential cmake pkgconf \n + libusb-0.1 libgpgme11 libarchive-tools fakeroot + Dev kit: + https://github.com/djdiskmachine/pspdev + using nano ~/.bashrc, add + export PSPDEV=~/pspdev + export PATH=$PATH:$PSPDEV/bin + at the end, then + source ~/.bashrc + +##### DINGOO: Compile under Linux + +##### RASPI: Compile under Linux + Required libs: + sudo apt install -y git gcc libsdl1.2-dev make g++ libjack-dev + diff --git a/sources/Adapters/PSP/FileSystem/PSPFileSystem.cpp b/sources/Adapters/PSP/FileSystem/PSPFileSystem.cpp index 195963f6..26fb5e56 100644 --- a/sources/Adapters/PSP/FileSystem/PSPFileSystem.cpp +++ b/sources/Adapters/PSP/FileSystem/PSPFileSystem.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include diff --git a/sources/Adapters/PSP/FileSystem/dirlist.cpp b/sources/Adapters/PSP/FileSystem/dirlist.cpp deleted file mode 100644 index 5260f953..00000000 --- a/sources/Adapters/PSP/FileSystem/dirlist.cpp +++ /dev/null @@ -1,61 +0,0 @@ - Uint16 i_FileList = 0; - int i, j; - - for(i=0; i -1.0f) - { - i1 = i1 | 0x80000000; - } - - for(j=0; j<4; j++) - { - ch1 = (i1 >> j*8) & 0x000000ff; - filelen=pgfWrite(fd,&ch1,1); - } - - if(data < 0.0f && data > -1.0f) - { - i1 = i1 & 0x7fffffff; - } - - // get remainder - flrem = data-(float)i1; - if(flrem < 0.0f) - { - flrem = -flrem; - } - - remcheck = 0.5f; - decbits = 0; - for(j=0; j<32; j++) - { - fltemp = flrem - remcheck; - if(fltemp>=0.0f) - { - flrem = flrem - remcheck; - decbits = decbits | (1<<(31-j)); - } - remcheck = remcheck/2.0f; - } - for(j=0; j<4; j++) - { - ch1 = decbits>>((3-j)*8); - filelen=pgfWrite(fd,&ch1,1); - } -} - - -void fwFloat(float data, FILE *outfile) -{ - int j; - int i1, decbits; - float flrem, remcheck, fltemp; - Uint8 ch1; - - // write upper 32bits first - i1 = (int)data; - if(data < 0.0f && data > -1.0f) - { - i1 = i1 | 0x80000000; - } - - for(j=0; j<4; j++) - { - ch1 = (i1 >> j*8) & 0x000000ff; - fwrite(&ch1, sizeof(Uint8), 1, outfile); - } - - if(data < 0.0f && data > -1.0f) - { - i1 = i1 & 0x7fffffff; - } - - // get remainder - flrem = data-(float)i1; - if(flrem < 0.0f) - { - flrem = -flrem; - } - - remcheck = 0.5f; - decbits = 0; - for(j=0; j<32; j++) - { - fltemp = flrem - remcheck; - if(fltemp>=0.0f) - { - flrem = flrem - remcheck; - decbits = decbits | (1<<(31-j)); - } - remcheck = remcheck/2.0f; - } - for(j=0; j<4; j++) - { - ch1 = decbits>>((3-j)*8); - fwrite(&ch1, sizeof(Uint8), 1, outfile); - } -} - -float frFloat(int fd) -{ - Uint32 ui1, ui2, ui3; - Sint32 si1; - int k; - Uint8 ch1; - float fl1; - - ui1 = 0; ui2 = 0; - for(k=0; k<4; k++) - { - pgfRead(fd, &ch1, 1); - ui1 = ui1 | (ch1<<(k)*8); - } - - for(k=0; k<4; k++) - { - pgfRead(fd, &ch1, 1); - ui3 = (ch1<<(3-k)*8); - ui2 = ui2 | ui3; - } - fl1 = (float)ui2; - fl1 = fl1/4294967296.0f; - - if(ui1 & 0x80000000) - { - if(ui1 == 0x80000000) - { - ui1 = 0x0; - } - si1 = (Sint32)ui1; - si1 = -si1; - fl1 = fl1 + float(si1); - fl1 = -fl1; - } - else - { - fl1 = fl1 + (float)ui1; - } - - return(fl1); -} - -float frFloat(FILE *infile) -{ - - Uint32 ui1, ui2, ui3; - Sint32 si1; - int k; - Uint8 ch1; - float fl1; - - ui1 = 0; ui2 = 0; - for(k=0; k<4; k++) - { - fread(&ch1, sizeof(Uint8), 1, infile); - ui1 = ui1 | (ch1<<(k)*8); - } - - for(k=0; k<4; k++) - { - fread(&ch1, sizeof(Uint8), 1, infile); - ui3 = (ch1<<(3-k)*8); - ui2 = ui2 | ui3; - } - fl1 = (float)ui2; - fl1 = fl1/4294967296.0f; - - if(ui1 & 0x80000000) - { - if(ui1 == 0x80000000) - { - ui1 = 0x0; - } - si1 = (Sint32)ui1; - si1 = -si1; - fl1 = fl1 + float(si1); - fl1 = -fl1; - } - else - { - fl1 = fl1 + (float)ui1; - } - - return(fl1); -} -#endif diff --git a/sources/Adapters/PSP/FileSystem/pspiofilemgr.h b/sources/Adapters/PSP/FileSystem/pspiofilemgr.h deleted file mode 100644 index 9bdfe4b4..00000000 --- a/sources/Adapters/PSP/FileSystem/pspiofilemgr.h +++ /dev/null @@ -1,477 +0,0 @@ -/* - * PSP Software Development Kit - http://www.pspdev.org - * ----------------------------------------------------------------------- - * Licensed under the BSD license, see LICENSE in PSPSDK root for details. - * - * pspiofilemgr.h - Prototypes for the sceIo library. - * - * Copyright (c) 2005 Marcus R. Brown - * Copyright (c) 2005 James Forshaw - * Copyright (c) 2005 John Kelley - * - * $Id: pspiofilemgr.h 1099 2005-10-02 13:06:46Z shine $ - */ -#ifndef __FILEIO_H__ -#define __FILEIO_H__ - -#include -#include -#include -#include - -/** @defgroup FileIO File IO Library - * This module contains the imports for the kernel's IO routines. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup FileIO File IO Library */ -/*@{*/ - -/** Permission value for the sceIoAssign function */ -enum IoAssignPerms -{ - /** Assign the device read/write */ - IOASSIGN_RDWR = 0, - /** Assign the device read only */ - IOASSIGN_RDONLY = 1 -}; - -/** - * Open or create a file for reading or writing - * - * @par Example1: Open a file for reading - * @code - * if(!(fd = sceIoOpen("device:/path/to/file", O_RDONLY, 0777)) { - * // error - * } - * @endcode - * @par Example2: Open a file for writing, creating it if it doesnt exist - * @code - * if(!(fd = sceIoOpen("device:/path/to/file", O_WRONLY|O_CREAT, 0777)) { - * // error - * } - * @endcode - * - * @param file - Pointer to a string holding the name of the file to open - * @param flags - Libc styled flags that are or'ed together - * @param mode - File access mode. - * @return A non-negative integer is a valid fd, anything else an error - */ -SceUID sceIoOpen(const char *file, int flags, SceMode mode); - -/** - * Open or create a file for reading or writing (asynchronous) - * - * @param file - Pointer to a string holding the name of the file to open - * @param flags - Libc styled flags that are or'ed together - * @param mode - File access mode. - * @return A non-negative integer is a valid fd, anything else an error - */ -SceUID sceIoOpenAsync(const char *file, int flags, SceMode mode); - -/** - * Delete a descriptor - * - * @code - * sceIoClose(fd); - * @endcode - * - * @param fd - File descriptor to close - * @return < 0 on error - */ -int sceIoClose(SceUID fd); - -/** - * Delete a descriptor (asynchronous) - * - * @param fd - File descriptor to close - * @return < 0 on error - */ -int sceIoCloseAsync(SceUID fd); - -/** - * Read input - * - * @par Example: - * @code - * bytes_read = sceIoRead(fd, data, 100); - * @endcode - * - * @param fd - Opened file descriptor to read from - * @param data - Pointer to the buffer where the read data will be placed - * @param size - Size of the read in bytes - * - * @return The number of bytes read - */ -int sceIoRead(SceUID fd, void *data, SceSize size); - -/** - * Read input (asynchronous) - * - * @par Example: - * @code - * bytes_read = sceIoRead(fd, data, 100); - * @endcode - * - * @param fd - Opened file descriptor to read from - * @param data - Pointer to the buffer where the read data will be placed - * @param size - Size of the read in bytes - * - * @return < 0 on error. - */ -int sceIoReadAsync(SceUID fd, void *data, SceSize size); - -/** - * Write output - * - * @par Example: - * @code - * bytes_written = sceIoWrite(fd, data, 100); - * @endcode - * - * @param fd - Opened file descriptor to write to - * @param data - Pointer to the data to write - * @param size - Size of data to write - * - * @return The number of bytes written - */ -int sceIoWrite(SceUID fd, const void *data, SceSize size); - -/** - * Write output (asynchronous) - * - * @param fd - Opened file descriptor to write to - * @param data - Pointer to the data to write - * @param size - Size of data to write - * - * @return < 0 on error. - */ -int sceIoWriteAsync(SceUID fd, const void *data, SceSize size); - -/** - * Reposition read/write file descriptor offset - * - * @par Example: - * @code - * pos = sceIoLseek(fd, -10, SEEK_END); - * @endcode - * - * @param fd - Opened file descriptor with which to seek - * @param offset - Relative offset from the start position given by whence - * @param whence - Set to SEEK_SET to seek from the start of the file, SEEK_CUR - * seek from the current position and SEEK_END to seek from the end. - * - * @return The position in the file after the seek. - */ -SceOff sceIoLseek(SceUID fd, SceOff offset, int whence); - -/** - * Reposition read/write file descriptor offset (asynchronous) - * - * @param fd - Opened file descriptor with which to seek - * @param offset - Relative offset from the start position given by whence - * @param whence - Set to SEEK_SET to seek from the start of the file, SEEK_CUR - * seek from the current position and SEEK_END to seek from the end. - * - * @return < 0 on error. Actual value should be passed returned by the ::sceIoWaitAsync call. - */ -int sceIoLseekAsync(SceUID fd, SceOff offset, int whence); - -/** - * Reposition read/write file descriptor offset (32bit mode) - * - * @par Example: - * @code - * pos = sceIoLseek32(fd, -10, SEEK_END); - * @endcode - * - * @param fd - Opened file descriptor with which to seek - * @param offset - Relative offset from the start position given by whence - * @param whence - Set to SEEK_SET to seek from the start of the file, SEEK_CUR - * seek from the current position and SEEK_END to seek from the end. - * - * @return The position in the file after the seek. - */ -int sceIoLseek32(SceUID fd, int offset, int whence); - -/** - * Reposition read/write file descriptor offset (32bit mode, asynchronous) - * - * @param fd - Opened file descriptor with which to seek - * @param offset - Relative offset from the start position given by whence - * @param whence - Set to SEEK_SET to seek from the start of the file, SEEK_CUR - * seek from the current position and SEEK_END to seek from the end. - * - * @return < 0 on error. - */ -int sceIoLseek32Async(SceUID fd, int offset, int whence); - -/** - * Remove directory entry - * - * @param file - Path to the file to remove - * @return < 0 on error - */ -int sceIoRemove(const char *file); - -/** - * Make a directory file - * - * @param dir - * @param mode - Access mode. - * @return Returns the value 0 if its succesful otherwise -1 - */ -int sceIoMkdir(const char *dir, SceMode mode); - -/** - * Remove a directory file - * - * @param path - Removes a directory file pointed by the string path - * @return Returns the value 0 if its succesful otherwise -1 - */ -int sceIoRmdir(const char *path); - -/** - * Change the current directory. - * - * @param path - The path to change to. - * @return < 0 on error. - */ -int sceIoChdir(const char *path); - -/** - * Change the name of a file - * - * @param oldname - The old filename - * @param newname - The new filename - * @return < 0 on error. - */ -int sceIoRename(const char *oldname, const char *newname); - -/** - * Open a directory - * - * @par Example: - * @code - * int dfd; - * dfd = sceIoDopen("device:/"); - * if(dfd >= 0) - * { Do something with the file descriptor } - * @endcode - * @param dirname - The directory to open for reading. - * @return If >= 0 then a valid file descriptor, otherwise a Sony error code. - */ -SceUID sceIoDopen(const char *dirname); - -/** - * Reads an entry from an opened file descriptor. - * - * @param fd - Already opened file descriptor (using sceIoDopen) - * @param dir - Pointer to an io_dirent_t structure to hold the file information - * - * @return Read status - * - 0 - No more directory entries left - * - > 0 - More directory entired to go - * - < 0 - Error - */ -int sceIoDread(SceUID fd, SceIoDirent *dir); - -/** - * Close an opened directory file descriptor - * - * @param fd - Already opened file descriptor (using sceIoDopen) - * @return < 0 on error - */ -int sceIoDclose(SceUID fd); - -/** - * Send a devctl command to a device. - * - * @par Example: Sending a simple command to a device (not a real devctl) - * @code - * sceIoDevctl("ms0:", 0x200000, indata, 4, NULL, NULL); - * @endcode - * - * @param dev - String for the device to send the devctl to (e.g. "ms0:") - * @param cmd - The command to send to the device - * @param indata - A data block to send to the device, if NULL sends no data - * @param inlen - Length of indata, if 0 sends no data - * @param outdata - A data block to receive the result of a command, if NULL receives no data - * @param outlen - Length of outdata, if 0 receives no data - * @return 0 on success, < 0 on error - */ -int sceIoDevctl(const char *dev, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen); - -/** - * Assigns one IO device to another (I guess) - * @param dev1 - The device name to assign. - * @param dev2 - The block device to assign from. - * @param dev3 - The filesystem device to mape the block device to dev1 - * @param mode - Read/Write mode. One of IoAssignPerms. - * @param unk1 - Unknown, set to NULL. - * @param unk2 - Unknown, set to 0. - * @return < 0 on error. - * - * @par Example: Reassign flash0 in read/write mode. - * @code - * sceIoUnassign("flash0"); - * sceIoAssign("flash0", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0); - * @endcode - * - */ -int sceIoAssign(const char *dev1, const char *dev2, const char *dev3, int mode, void* unk1, long unk2); - -/** - * Unassign an IO device. - * @param dev - The device to unassign. - * @return < 0 on error - * - * @par Example: See ::sceIoAssign - */ -int sceIoUnassign(const char *dev); - -/** - * Get the status of a file. - * - * @param file - The path to the file. - * @param stat - A pointer to an io_stat_t structure. - * - * @return < 0 on error. - */ -int sceIoGetstat(const char *file, SceIoStat *stat); - -/** - * Change the status of a file. - * - * @param file - The path to the file. - * @param stat - A pointer to an io_stat_t structure. - * @param bits - Bitmask defining which bits to change. - * - * @return < 0 on error. - */ -int sceIoChstat(const char *file, SceIoStat *stat, int bits); - -/** - * Perform an ioctl on a device. - * - * @param fd - Opened file descriptor to ioctl to - * @param cmd - The command to send to the device - * @param indata - A data block to send to the device, if NULL sends no data - * @param inlen - Length of indata, if 0 sends no data - * @param outdata - A data block to receive the result of a command, if NULL receives no data - * @param outlen - Length of outdata, if 0 receives no data - * @return 0 on success, < 0 on error - */ -int sceIoIoctl(SceUID fd, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen); - -/** - * Perform an ioctl on a device. (asynchronous) - * - * @param fd - Opened file descriptor to ioctl to - * @param cmd - The command to send to the device - * @param indata - A data block to send to the device, if NULL sends no data - * @param inlen - Length of indata, if 0 sends no data - * @param outdata - A data block to receive the result of a command, if NULL receives no data - * @param outlen - Length of outdata, if 0 receives no data - * @return 0 on success, < 0 on error - */ -int sceIoIoctlAsync(SceUID fd, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen); - -/** - * Synchronise the file data on the device. - * - * @param device - The device to synchronise (e.g. msfat0:) - * @param unk - Unknown - */ -int sceIoSync(const char *device, unsigned int unk); - -/** - * Wait for asyncronous completion. - * - * @param fd - The file descriptor which is current performing an asynchronous action. - * @param res - The result of the async action. - * - * @return < 0 on error. - */ -int sceIoWaitAsync(SceUID fd, long long *res); - -/** - * Wait for asyncronous completion (with callbacks). - * - * @param fd - The file descriptor which is current performing an asynchronous action. - * @param res - The result of the async action. - * - * @return < 0 on error. - */ -int sceIoWaitAsyncCB(SceUID fd, long long *res); - -/** - * Poll for asyncronous completion. - * - * @param fd - The file descriptor which is current performing an asynchronous action. - * @param res - The result of the async action. - * - * @return < 0 on error. - */ -int sceIoPollAsync(SceUID fd, long long *res); - -/** - * Get the asyncronous completion status. - * - * @param fd - The file descriptor which is current performing an asynchronous action. - * @param poll - If 0 then waits for the status, otherwise it polls the fd. - * @param res - The result of the async action. - * - * @return < 0 on error. - */ -int sceIoGetAsyncStat(SceUID fd, int poll, long long *res); - -/** - * Cancel an asynchronous operation on a file descriptor. - * - * @param fd - The file descriptor to perform cancel on. - * - * @return < 0 on error. - */ -int sceIoCancel(SceUID fd); - -/** - * Get the device type of the currently opened file descriptor. - * - * @param fd - The opened file descriptor. - * - * @return < 0 on error. Otherwise the device type? - */ -int sceIoGetDevType(SceUID fd); - -/** - * Change the priority of the asynchronous thread. - * - * @param fd - The opened fd on which the priority should be changed. - * @param pri - The priority of the thread. - * - * @return < 0 on error. - */ -int sceIoChangeAsyncPriority(SceUID fd, int pri); - -/** - * Sets a callback for the asynchronous action. - * - * @param fd - The filedescriptor currently performing an asynchronous action. - * @param cb - The UID of the callback created with ::sceKernelCreateCallback - * @param argp - Pointer to an argument to pass to the callback. - * - * @return < 0 on error. - */ -int sceIoSetAsyncCallback(SceUID fd, SceUID cb, void *argp); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/sources/Application/Model/Project.h b/sources/Application/Model/Project.h index eb38c16f..6487614d 100644 --- a/sources/Application/Model/Project.h +++ b/sources/Application/Model/Project.h @@ -16,8 +16,8 @@ #define VAR_TRANSPOSE MAKE_FOURCC('T','R','S','P') #define PROJECT_NUMBER "1.3" -#define PROJECT_RELEASE "n" -#define BUILD_COUNT "052" +#define PROJECT_RELEASE "psp_djdiskmachine" +#define BUILD_COUNT "000" #define MAX_TAP 3 diff --git a/sources/System/Console/Trace.cpp b/sources/System/Console/Trace.cpp index 62b1708f..30d6971a 100644 --- a/sources/System/Console/Trace.cpp +++ b/sources/System/Console/Trace.cpp @@ -21,7 +21,7 @@ void Trace::AddLine(const char* line) } else { - printf("Trying to log %s before logger is installed",line); + printf("%s (logger uninit)\n",line); } }