Fix all the warning in the PSPSDK samples

This commit is contained in:
Francisco Javier Trujillo Mata
2025-06-07 16:31:55 +02:00
parent 2a19c50015
commit c665eedbf2
14 changed files with 42 additions and 29 deletions

View File

@@ -104,7 +104,7 @@ int extract_file(const char* name, const char* dstname)
if(size >= 0) if(size >= 0)
{ {
printf("Extracted file - size %d\n", size); printf("Extracted file - size %ld\n", size);
fd = sceIoOpen(dstname, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777); fd = sceIoOpen(dstname, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
if(fd >= 0) if(fd >= 0)
{ {

View File

@@ -2,7 +2,7 @@ TARGET = vertex
OBJS = vertex.o ../common/callbacks.o ../common/menu.o OBJS = vertex.o ../common/callbacks.o ../common/menu.o
INCDIR = INCDIR =
CFLAGS = -Wall CFLAGS = -Wall -ffast-math
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS) ASFLAGS = $(CFLAGS)

View File

@@ -131,7 +131,7 @@ void generateVertexBuffer(int vertexFormat, void* vertices, int batchSize)
memset(current,0,vertexSize); memset(current,0,vertexSize);
// TODO: render something nice // TODO: render something nice
/*
float x = cosf((i * batchScale) * (GU_PI*2)); float x = cosf((i * batchScale) * (GU_PI*2));
float y = sinf((i * batchScale) * (GU_PI*2)); float y = sinf((i * batchScale) * (GU_PI*2));
@@ -180,7 +180,7 @@ void generateVertexBuffer(int vertexFormat, void* vertices, int batchSize)
} }
break; break;
} }
*/
current = current + vertexSize; current = current + vertexSize;
} }
} }
@@ -253,7 +253,7 @@ int main(int argc, char* argv[])
// run sample // run sample
int val = 0; int frame = 0;
SceCtrlData oldPad; SceCtrlData oldPad;
memset(&oldPad,0,sizeof(SceCtrlData)); memset(&oldPad,0,sizeof(SceCtrlData));
@@ -598,7 +598,7 @@ int main(int argc, char* argv[])
pspDebugScreenSetOffset((int)fbp0); pspDebugScreenSetOffset((int)fbp0);
pspDebugScreenSetXY(0,0); pspDebugScreenSetXY(0,0);
pspDebugScreenPrintf("Mask: 0x%08x, Size: %u", vertexMask, vertexSize,val); pspDebugScreenPrintf("Mask: 0x%08x, Size: %u, frame: %d", vertexMask, vertexSize, frame);
if (avgVertexSpeed) if (avgVertexSpeed)
pspDebugScreenPrintf(", %.2f million vertices / sec.",avgVertexSpeed); pspDebugScreenPrintf(", %.2f million vertices / sec.",avgVertexSpeed);
else else
@@ -613,7 +613,7 @@ int main(int argc, char* argv[])
fbp1 = fbp0; fbp1 = fbp0;
fbp0 = sceGuSwapBuffers(); fbp0 = sceGuSwapBuffers();
val++; frame++;
} }
sceGuTerm(); sceGuTerm();

View File

@@ -171,7 +171,7 @@ void dump_cop0_regs(void)
printf("Cop0 regs\n"); printf("Cop0 regs\n");
for(i = 0; i < 32; i+=4) for(i = 0; i < 32; i+=4)
{ {
printf("$%02d: %08X, $%02d: %08X, $%02d: %08X $%02d: %08X\n", printf("$%02d: %08lX, $%02d: %08lX, $%02d: %08lX $%02d: %08lX\n",
i, regs[i], i+1, regs[i+1], i+2, regs[i+2], i+3, regs[i+3]); i, regs[i], i+1, regs[i+1], i+2, regs[i+2], i+3, regs[i+3]);
} }
} }

View File

@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
pspDebugScreenSetXY(0, 0); pspDebugScreenSetXY(0, 0);
pspDebugScreenPrintf("ME Basic Example, press Home to exit\n"); pspDebugScreenPrintf("ME Basic Example, press Home to exit\n");
sceKernelDcacheWritebackInvalidateAll(); sceKernelDcacheWritebackInvalidateAll();
pspDebugScreenPrintf("ME Counter: %08x\n", *count); pspDebugScreenPrintf("ME Counter: %08lx\n", *count);
sceCtrlReadBufferPositive(&ctl, 1); sceCtrlReadBufferPositive(&ctl, 1);
if(ctl.Buttons & PSP_CTRL_HOME) if(ctl.Buttons & PSP_CTRL_HOME)
{ {

View File

@@ -246,6 +246,8 @@ int net_thread(SceSize args, void *argp)
start_server(info.ip); start_server(info.ip);
} }
} while (0); } while (0);
return 0;
} }
/* Simple thread */ /* Simple thread */
int main(int argc, char **argv) int main(int argc, char **argv)

View File

@@ -78,7 +78,6 @@ const char *caps[8] = {
void print_apsum(struct ScanData *pData) void print_apsum(struct ScanData *pData)
{ {
char name[33]; char name[33];
int loop;
strncpy(name, pData->name, 32); strncpy(name, pData->name, 32);
name[32] = 0; name[32] = 0;
printf("RSSI:%02d ", pData->rssi); printf("RSSI:%02d ", pData->rssi);

View File

@@ -87,8 +87,8 @@ int main(void)
SceUID modid; SceUID modid;
SceModule *mod; SceModule *mod;
int i; int i;
int ret;
int fd; int fd;
int ret = -1;
pspDebugScreenInit(); pspDebugScreenInit();
@@ -126,5 +126,5 @@ int main(void)
/* Let's bug out */ /* Let's bug out */
sceKernelExitDeleteThread(0); sceKernelExitDeleteThread(0);
return 0; return ret >= 0 ? 0 : ret;
} }

View File

@@ -27,7 +27,8 @@ PSP_MODULE_INFO("SaveDecrypt", 0, 1, 1);
#define printf pspDebugScreenPrintf #define printf pspDebugScreenPrintf
const char *decrypted = "ms0:/PLAIN.BIN"; const char *decrypted = "ms0:/PLAIN.BIN";
#if 0 #define USE_OLD_FORMAT 0
#if USE_OLD_FORMAT
/* Old format save with no key, supported by 1.0+ firmware */ /* Old format save with no key, supported by 1.0+ firmware */
const char *encrypted = "ms0:/PSP/SAVEDATA/DATA111110000/DATA.BIN"; const char *encrypted = "ms0:/PSP/SAVEDATA/DATA111110000/DATA.BIN";
const unsigned char *gamekey = NULL; const unsigned char *gamekey = NULL;
@@ -66,12 +67,16 @@ int main(int argc, char *argv[])
printf("Will decrypt: %s\n", encrypted); printf("Will decrypt: %s\n", encrypted);
printf(" Using key:"); printf(" Using key:");
if(gamekey) { #if USE_OLD_FORMAT
for (i = 0; i < 0x10; i++) {
printf(" %02x", gamekey[i]);
} else {
printf(" none"); printf(" none");
} }
#else
{
for (i = 0; i < 0x10; i++)
printf(" %02x", gamekey[i]);
}
#endif
printf("\n\n"); printf("\n\n");
printf(" Output file: %s\n\n", decrypted); printf(" Output file: %s\n\n", decrypted);
printf("Press X to continue, or O to quit.\n\n"); printf("Press X to continue, or O to quit.\n\n");

View File

@@ -26,7 +26,8 @@ PSP_MODULE_INFO("SaveEncrypt", 0, 1, 1);
#define printf pspDebugScreenPrintf #define printf pspDebugScreenPrintf
#if 0 #define USE_OLD_FORMAT 0
#if USE_OLD_FORMAT
/* Old format save with no key, supported by 1.0+ firmware */ /* Old format save with no key, supported by 1.0+ firmware */
const char *plaintext = "ms0:/PLAIN.BIN"; const char *plaintext = "ms0:/PLAIN.BIN";
const char *encrypted = "ms0:/PSP/SAVEDATA/DATA111110000/DATA.BIN"; const char *encrypted = "ms0:/PSP/SAVEDATA/DATA111110000/DATA.BIN";
@@ -71,12 +72,16 @@ int main(int argc, char *argv[])
printf(" Will encrypt: %s\n", plaintext); printf(" Will encrypt: %s\n", plaintext);
printf(" Using key:"); printf(" Using key:");
if(gamekey) { #if USE_OLD_FORMAT
for (i = 0; i < 0x10; i++) {
printf(" %02x", gamekey[i]);
} else {
printf(" none"); printf(" none");
} }
#else
{
for (i = 0; i < 0x10; i++)
printf(" %02x", gamekey[i]);
}
#endif
printf("\n\n"); printf("\n\n");
printf(" Output file: %s\n", encrypted); printf(" Output file: %s\n", encrypted);
printf("Update hashes: %s\n\n", paramsfo); printf("Update hashes: %s\n\n", paramsfo);

View File

@@ -213,7 +213,7 @@ char nameMultiple[][20] = // End list with ""
"" ""
}; };
char key[] = "QTAK319JQKJ952HA"; // Key to encrypt or decrypt savedata static const char key[] = "QTAK319JQKJ952H"; // Key to encrypt or decrypt savedata
void initSavedata(SceUtilitySavedataParam * savedata, int mode) void initSavedata(SceUtilitySavedataParam * savedata, int mode)
{ {
@@ -232,7 +232,7 @@ void initSavedata(SceUtilitySavedataParam * savedata, int mode)
savedata->focus = PSP_UTILITY_SAVEDATA_FOCUS_LATEST; // Set initial focus to the newest file (for loading) savedata->focus = PSP_UTILITY_SAVEDATA_FOCUS_LATEST; // Set initial focus to the newest file (for loading)
#if defined(_PSP_FW_VERSION) && _PSP_FW_VERSION >= 200 #if defined(_PSP_FW_VERSION) && _PSP_FW_VERSION >= 200
strncpy(savedata->key, key, 16); strncpy(savedata->key, key, sizeof(savedata->key));
#endif #endif
strcpy(savedata->gameName, "DEMO11111"); // First part of the save name, game identifier name strcpy(savedata->gameName, "DEMO11111"); // First part of the save name, game identifier name

View File

@@ -155,19 +155,19 @@ int main(void)
//setup USB drivers //setup USB drivers
retVal = sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0); retVal = sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0);
if (retVal != 0) { if (retVal != 0) {
printf("Error starting USB Bus driver (0x%08X)\n", retVal); printf("Error starting USB Bus driver (0x%08lX)\n", retVal);
sceKernelSleepThread(); sceKernelSleepThread();
} }
retVal = sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0); retVal = sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0);
if (retVal != 0) { if (retVal != 0) {
printf("Error starting USB Mass Storage driver (0x%08X)\n", printf("Error starting USB Mass Storage driver (0x%08lX)\n",
retVal); retVal);
sceKernelSleepThread(); sceKernelSleepThread();
} }
retVal = sceUsbstorBootSetCapacity(0x800000); retVal = sceUsbstorBootSetCapacity(0x800000);
if (retVal != 0) { if (retVal != 0) {
printf printf
("Error setting capacity with USB Mass Storage driver (0x%08X)\n", ("Error setting capacity with USB Mass Storage driver (0x%08lX)\n",
retVal); retVal);
sceKernelSleepThread(); sceKernelSleepThread();
} }

View File

@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
//clear netData //clear netData
data.asUint = 0xBADF00D; data.asUint = 0xBADF00D;
memset(&data.asString[4], 0, 124); memset(&data.asString[4], 0, 124);
printf("param %03d: ret(0x%08X) uint(%d) string(%s)\n", i, sceUtilityGetNetParam(netConfIndex, i, &data), data.asUint, data.asString); printf("param %03d: ret(0x%08X) uint(%ld) string(%s)\n", i, sceUtilityGetNetParam(netConfIndex, i, &data), data.asUint, data.asString);
} }
printf("\nPress X to show details for next net configuration.\n"); printf("\nPress X to show details for next net configuration.\n");
sceDisplayWaitVblankStart(); sceDisplayWaitVblankStart();

View File

@@ -114,7 +114,9 @@ SceUID sceKernelLoadModuleBufferUsbWlan(SceSize bufsize, void *buf, int flags, S
* @param status - Returns the status of the start. * @param status - Returns the status of the start.
* @param option - Pointer to an optional ::SceKernelSMOption structure. * @param option - Pointer to an optional ::SceKernelSMOption structure.
* *
* @return ??? on success, otherwise one of ::PspKernelErrorCodes. * @return modID (modID > 0) UID of the module that was started and made resident,
* 0 on success for modules that don't need to be made resident,
* otherwise one of ::PspKernelErrorCodes.
*/ */
int sceKernelStartModule(SceUID modid, SceSize argsize, void *argp, int *status, SceKernelSMOption *option); int sceKernelStartModule(SceUID modid, SceSize argsize, void *argp, int *status, SceKernelSMOption *option);