Skip to content

Commit 6a4d078

Browse files
authored
Merge pull request #58 from joel16/module
module: Revert loading external modules from memory, update libs, more optimizations and fix builds for recent sdk changes
2 parents f7f1c04 + c3dd313 commit 6a4d078

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+4819
-18127
lines changed

.github/workflows/c-cpp.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,16 @@ jobs:
1919
2020
- name: Compile project
2121
run: make
22-
22+
23+
- name: Prepare artifact folder
24+
run: |
25+
mkdir -p CMFileManagerPSP
26+
cp audio_driver/audio_driver.prx CMFileManagerPSP/
27+
cp display_driver/display_driver.prx CMFileManagerPSP/
28+
cp fs_driver/fs_driver.prx CMFileManagerPSP/
29+
cp app/EBOOT.PBP CMFileManagerPSP/
30+
2331
- uses: actions/upload-artifact@v4
2432
with:
25-
name: CMFileManager-PSP
26-
path: app/EBOOT.PBP
33+
name: CMFileManagerPSP
34+
path: CMFileManagerPSP/

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ Mkfile.old
5454
dkms.conf
5555

5656
# CMFileManager PSP Specific objects
57+
app/drivers/audio_driver.S
5758
app/drivers/display_driver.S
5859
app/drivers/fs_driver.S
59-
app/drivers/module_driver.S
60+
app/drivers/input_driver.S
6061
app/*.json
6162
app/*.log

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SUBDIRS = display_driver fs_driver module_driver app launcher
1+
SUBDIRS = audio_driver display_driver fs_driver app launcher
22

33
all:
44
@for dir in $(SUBDIRS); do $(MAKE) -C $$dir; done

app/Makefile

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
TARGET = CMFileManager
22

33
SOURCES := data drivers source source/audio source/gui ../libs/libnsbmp ../libs/libnsgif
4-
CFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.c))
5-
SFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.S))
6-
CPPFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.cpp))
7-
FONTFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.pgf))
8-
GFXFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.png))
9-
PRXFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.prx))
4+
CFILES := $(foreach dir,$(SOURCES), $(wildcard $(dir)/*.c))
5+
SFILES := $(foreach dir,$(SOURCES), $(wildcard $(dir)/*.S))
6+
CPPFILES := $(foreach dir,$(SOURCES), $(wildcard $(dir)/*.cpp))
7+
GFXFILES := $(foreach dir,$(SOURCES), $(wildcard $(dir)/*.png))
8+
FONTFILES := $(foreach dir,$(SOURCES), $(wildcard $(dir)/*.pgf))
109

11-
OBJS := $(addsuffix .o,$(BINFILES)) $(CFILES:.c=.o) $(SFILES:.S=.o) $(CPPFILES:.cpp=.o) \
12-
$(FONTFILES:.pgf=.o) $(GFXFILES:.png=.o) $(PRXFILES:.prx=.o)
10+
OBJS := $(addsuffix .o,$(BINFILES)) \
11+
$(CFILES:.c=.o) $(SFILES:.S=.o) $(CPPFILES:.cpp=.o) $(GFXFILES:.png=.o) $(FONTFILES:.pgf=.o)
1312

1413
VERSION_MAJOR := 4
1514
VERSION_MINOR := 1
1615
VERSION_MICRO := 0
1716

1817
INCDIR = ../libs/ ../libs/include ../libs/libnsbmp ../libs/libnsgif ../libs/include/opus include
19-
CFLAGS = -Os -G0 -Wall -ffast-math -Wno-narrowing -Wno-unused-variable \
18+
CFLAGS = -Os -mno-gpopt -Wall -ffast-math -Wno-narrowing -Wno-unused-variable \
2019
-DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_MICRO=$(VERSION_MICRO)
2120
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti -std=gnu++17
2221
ASFLAGS := $(CFLAGS)
@@ -26,22 +25,19 @@ BUILD_PRX = 1
2625
LIBDIR = ../libs/lib
2726
LDFLAGS =
2827
LIBS = -lintrafont -lglib2d -lxmp -lmpg123 -lvorbisfile -lvorbis -lopusfile -lopus -lFLAC -logg \
29-
-larchive -llzma -ljpeg -lpng16 -lstdc++ -lz \
28+
-larchive -llzma -lturbojpeg -ljpeg -lpng16 -lstdc++ -lz \
3029
-lpspkubridge -lpspsystemctrl_user -lpspusbdevice \
3130
-lpspgu -lpspvram -lpspaudio -lpsppower -lpspreg -lpspusb -lpspusbstor -lpspumd
3231

33-
EXTRA_TARGETS = EBOOT.PBP
34-
PSP_EBOOT_TITLE = CM File Manager PSP v$(VERSION_MAJOR).$(VERSION_MINOR)$(VERSION_MICRO)
35-
PSP_EBOOT_ICON = ../ICON0.PNG
32+
EXTRA_TARGETS = EBOOT.PBP
33+
PSP_EBOOT_TITLE = CM File Manager PSP v$(VERSION_MAJOR).$(VERSION_MINOR)$(VERSION_MICRO)
34+
PSP_EBOOT_ICON = ../ICON0.PNG
3635

3736
PSPSDK=$(shell psp-config --pspsdk-path)
3837
include $(PSPSDK)/lib/build.mak
3938

40-
%.o: %.pgf
41-
bin2o -i $< $@ $(addsuffix _pgf, $(basename $(notdir $<) ))
42-
4339
%.o: %.png
4440
bin2o -i $< $@ $(addsuffix _png, $(basename $(notdir $<) ))
4541

46-
%.o: %.prx
47-
bin2o -i $< $@ $(addsuffix _prx, $(basename $(notdir $<) ))
42+
%.o: %.pgf
43+
bin2o -i $< $@ $(addsuffix _pgf, $(basename $(notdir $<) ))

app/include/fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace FS {
2525
int MakeDir(const std::string &path);
2626
int RecursiveMakeDir(const std::string &path);
2727
int CreateFile(const std::string &path);
28-
std::string GetFileExt(const std::string &filename);
28+
const char* GetFileExt(const char *filename);
2929
FileType GetFileType(const std::string &filename);
3030
SceOff GetFileSize(const std::string &path);
3131
char *GetFileTimestamp(SceIoStat &stat, FileTimestamp time);

app/include/kernel_functions.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ extern "C" {
66

77
#include <pspctrl.h>
88
#include <pspiofilemgr.h>
9-
#include <pspmodulemgr.h>
109

1110
// Kernel function prototypes
1211

1312
// audio_driver functions
14-
int pspAudioSetFrequency(int frequency);
13+
extern int pspAudioSetFrequency(int frequency);
1514

1615
// display_driver functions
1716
extern int pspDisplayEnable(void);
@@ -34,9 +33,6 @@ extern int pspIoRename(const char *oldname, const char *newname);
3433
extern int pspIoRemoveFile(const char *file);
3534
extern int pspIoDevctl(const char *dev, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
3635

37-
// module_driver functions
38-
extern int pspKernelLoadModuleBuffer(SceSize size, void *buf, s32 flag, const SceKernelLMOption *option);
39-
4036
#if defined (__cplusplus)
4137
}
4238
#endif

app/include/textures.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extern g2dTexture *file_icons[NUM_FILE_ICONS], *icon_dir[NUM_THEMES], *icon_chec
1919
namespace Textures {
2020
g2dTexture *LoadImageBufferJPEG(unsigned char *data, int size);
2121
g2dTexture *LoadImageBufferPNG(unsigned char *data, int size);
22-
g2dTexture *LoadImage(const std::string &path);
22+
g2dTexture *LoadImage(const std::string &path, int size);
2323
void Load(void);
2424
void Free(void);
2525
}

app/source/audio.cpp

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include <pspaudio.h>
22
#include <pspthreadman.h>
3-
#include <string.h>
3+
#include <cstring>
44

55
#include "fs.h"
66
#include "kernel_functions.h"
@@ -37,32 +37,37 @@ namespace Audio {
3737

3838
static void Decode(void *buf, unsigned int length, void *userdata) {
3939
if ((!playing) || (paused)) {
40-
s16 *buf_s16 = static_cast<s16 *>(buf);
41-
for (unsigned int count = 0; count < length * 4; count++)
42-
*(buf_s16 + count) = 0;
40+
std::memset(buf, 0, length * 4);
4341
}
44-
else
45-
(* decoder.decode)(buf, length, userdata);
42+
else {
43+
(*decoder.decode)(buf, length, userdata);
44+
}
4645
}
4746

4847
void Init(const std::string &path) {
4948
playing = true;
5049
paused = false;
50+
const char *ext = FS::GetFileExt(path.c_str());
5151

52-
std::string ext = FS::GetFileExt(path);
53-
54-
if (!ext.compare(".FLAC"))
52+
if (strncasecmp(ext, "flac", 4) == 0) {
5553
file_type = FILE_TYPE_FLAC;
56-
else if (!ext.compare(".MP3"))
54+
}
55+
else if (strncasecmp(ext, "mp3", 3) == 0) {
5756
file_type = FILE_TYPE_MP3;
58-
else if (!ext.compare(".OGG"))
57+
}
58+
else if (strncasecmp(ext, "ogg", 3) == 0) {
5959
file_type = FILE_TYPE_OGG;
60-
else if (!ext.compare(".OPUS"))
60+
}
61+
else if (strncasecmp(ext, "opus", 4) == 0) {
6162
file_type = FILE_TYPE_OPUS;
62-
else if (!ext.compare(".WAV"))
63+
}
64+
else if (strncasecmp(ext, "wav", 3) == 0) {
6365
file_type = FILE_TYPE_WAV;
64-
else if ((!ext.compare(".IT")) || (!ext.compare(".MOD")) || (!ext.compare(".S3M")) || (!ext.compare(".XM")))
66+
}
67+
else if ((strncasecmp(ext, "it", 2) == 0) || (strncasecmp(ext, "mod", 3) == 0) || (strncasecmp(ext, "s3m", 3) == 0)
68+
|| (strncasecmp(ext, "xm", 2) == 0)) {
6569
file_type = FILE_TYPE_XM;
70+
}
6671

6772
switch(file_type) {
6873
case FILE_TYPE_FLAC:
@@ -184,9 +189,8 @@ namespace Audio {
184189
(* decoder.term)();
185190

186191
// Clear metadata struct
187-
if (metadata.has_meta) {
188-
if (metadata.cover_image)
189-
g2dTexFree(&metadata.cover_image);
192+
if (metadata.has_meta && metadata.cover_image) {
193+
g2dTexFree(&metadata.cover_image);
190194
}
191195

192196
metadata = { 0 };

app/source/audio/ogg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include <pspiofilemgr.h>
2+
#include <vorbis/codec.h>
3+
#include <vorbis/vorbisfile.h>
24

35
#include "audio.h"
46
#include "utils.h"
5-
#include "vorbis/codec.h"
6-
#include "vorbis/vorbisfile.h"
77

88
namespace OGG {
99
static OggVorbis_File ogg;

app/source/audio/xm.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#include <xmp.h>
2+
13
#include "audio.h"
2-
#include "xmp.h"
34

45
namespace XM {
56
static xmp_context xmp;

0 commit comments

Comments
 (0)