From 05f814a1ce7e5b75135d294e2048692e2f0aec5f Mon Sep 17 00:00:00 2001 From: Tanner Babcock Date: Fri, 23 Aug 2019 04:55:19 -0500 Subject: [PATCH] Clean up code, added helpful info to README --- README.md | 18 ++++++++++++++++++ src/draw.c | 1 - src/file.c | 13 ++++++------- src/grid.c | 2 -- src/menu.c | 5 ----- src/sound.c | 3 --- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 395ca61..105d6f1 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,24 @@ Press **START** to use the menu, and use the **D-pad** to select a menu item or You can play up to twelve measures in a row by using the **R and L** triggers, or by switching the "grid" value in the **START** mneu. If "loop all" is on, then the measures will play one after another. If it is off, it will only repeat one measure. It is recommended that you stop playback before editing another grid. +## How PSP Homebrew is Built + +When I wrote PSP software as a teenager, I used a Windows build of the [universally-known PSP SDK](https://github.com/pspdev/pspsdk), through Wine, on my Mac. The build process revolves around GNU Make, but there are many extra steps. Every PSP binary is named `EBOOT.PBP` ("PSP binary package"). The actual machine code is only one out of up to eight elements. + +* `PARAM.SFO` - Metadata about the program, contains its title, version, language, and parental rating - the program will not be recognized at all if this is not present +* `DATA.PSP` - The binary itself, usually comes as a \*.elf or a \*.prx (in typical Executable and Linkable format), technically has no filename until it's dumped from the package + +A package really only needs these first two, the six remaining elements are totally optional. + +* `DATA.PSAR` - Compressed archive for system software updates or video game updates +* `ICON0.PNG` - The icon of the game or app, appears in the vertical list next to the others when in the XMB +* `ICON1.PMF` - A short animation that takes the place of `ICON0.PNG` when focused - no audio included (.PMF is a native video format on PSP, .PAM is the PS3 version) +* `PIC0.PNG` - A caption or description image, appears on top of `PIC1.PNG` and after a short delay +* `PIC1.PNG` - The background image that appears behind the XMB icons when focused +* `SND0.AC3` - Sound that plays - often theme music for a game or a movie + +One specifies which real files they want compiled into their EBOOT via the [Makefile](https://github.com/Babkock/ToneMatrix/blob/master/src/Makefile). The PARAM.SFO is generated by **mksfo**, the PRX is built from **psp-prxgen**, and the PBP is packaged with **pack-pbp** (it can be unpackaged with **unpack-pbp**). + ## Installation If you have custom firmware or a homebrew-enabled PSP, place the **"unsigned"** folder into the `/PSP/GAME` folder on your Memory Stick. If you have official firmware on your PSP (or if you have a PSPgo), place the **"signed"** folder into the `/PSP/GAME` folder on your Memory Stick. diff --git a/src/draw.c b/src/draw.c index 606f4f4..34c40cb 100644 --- a/src/draw.c +++ b/src/draw.c @@ -38,5 +38,4 @@ void tmDrawGrid(void) { oslDrawImageXY(select, x1form, y1form); } } - return; } diff --git a/src/file.c b/src/file.c index c66c794..fbd01a3 100644 --- a/src/file.c +++ b/src/file.c @@ -7,6 +7,11 @@ #include #include "main.h" +typedef struct { + int year, month, day; + int minute, hour; +} metadata; + void tmFileDialog(bool save) { int x; unsigned char option = 0; @@ -16,10 +21,7 @@ void tmFileDialog(bool save) { char tmp[30]; SceIoStat a; - typedef struct { - int year, month, day; - int minute, hour; - } metadata; + metadata songMeta[MAX_SAVE_SLOTS]; current = 0; @@ -104,7 +106,6 @@ void tmFileDialog(bool save) { oslEndDrawing(); oslSyncFrame(); } - return; } bool tmDoesFileExist(const char *path) { @@ -133,7 +134,6 @@ void tmRead(int slot) { fseek(in, 5, SEEK_CUR); } fclose(in); - return; } void tmWrite(int slot) { @@ -154,5 +154,4 @@ void tmWrite(int slot) { fprintf(out, "%c%c%c%c\a", 82, 42, 82, 22); } fclose(out); - return; } diff --git a/src/grid.c b/src/grid.c index f886386..dd2fe08 100644 --- a/src/grid.c +++ b/src/grid.c @@ -11,7 +11,6 @@ void tmClear(tmGrid *g) { g->grid[y][z] = OFF; } g->grid[0][0] = CURSOFF; - return; } bool tmIsGridEmpty(tmGrid *g) { @@ -36,5 +35,4 @@ void tmSwitchGrid(int *a, int *b) { data[current].grid[x][y] = OFF; } } - return; } diff --git a/src/menu.c b/src/menu.c index b55050e..42ef57a 100644 --- a/src/menu.c +++ b/src/menu.c @@ -7,7 +7,6 @@ unsigned char tmMenu(void) { int x; char mstrings[MAX_MENU_ITEMS][40]; - char ver[25]; while (!osl_quit) { oslStartDrawing(); oslReadKeys(); @@ -57,9 +56,6 @@ unsigned char tmMenu(void) { oslDrawString(10, (60+(x*10)), mstrings[x]); oslSetTextColor(RGBA(255,255,255,255)); } - bzero(ver, sizeof(ver)); - // sprintf(ver, "ToneMatrix %s by Babkock", VERSION); - oslDrawString(10, 240, ver); if ((osl_keys->pressed.up) && (menuoption > 0)) { menuoption--; if (menuoption == BREAK) @@ -163,7 +159,6 @@ void tmHelp(void) { oslEndDrawing(); oslSyncFrame(); } - return; } bool tmClearAllWarning(void) { diff --git a/src/sound.c b/src/sound.c index aad9066..98e4ca0 100644 --- a/src/sound.c +++ b/src/sound.c @@ -30,18 +30,15 @@ void tmSoundLoop(void) { } } sceKernelExitDeleteThread(0); - return; } void tmStop(void) { isplaying = FALSE; col = 0; sceKernelTerminateThread(soundloop); - return; } void tmStart(void) { isplaying = TRUE; sceKernelStartThread(soundloop, 0, NULL); - return; }