mirror of
https://github.com/joel16/CMFileManager-PSP.git
synced 2024-11-23 03:39:42 +00:00
next: Make changes for new toolchain and use libjpeg instead of turbojpeg
This commit is contained in:
parent
d1950c9fb7
commit
e7edd0212e
16
.github/workflows/c-cpp.yml
vendored
16
.github/workflows/c-cpp.yml
vendored
@ -8,26 +8,34 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
container: pspdev/pspdev:latest
|
||||
steps:
|
||||
- uses: krystalgamer/setup-psptoolchain@1.0
|
||||
- uses: actions/checkout@v2
|
||||
- name: Compile
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apk add build-base git bash cmake
|
||||
|
||||
- name: Compile project
|
||||
run: make
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
path: audio_driver/audio_driver.prx
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
path: display_driver/display_driver.prx
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
path: fs_driver/fs_driver.prx
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
path: input_driver/input_driver.prx
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
path: app/EBOOT.PBP
|
||||
|
12
app/Makefile
12
app/Makefile
@ -15,9 +15,9 @@ VERSION_MINOR := 0
|
||||
VERSION_MICRO := 1
|
||||
|
||||
INCDIR = ../libs/ ../libs/include ../libs/libnsbmp ../libs/libnsgif ../libs/include/opus include
|
||||
CFLAGS = -Os -G0 -Wall -ffast-math -fno-exceptions -Wno-narrowing -Wno-unused-variable \
|
||||
-DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_MICRO=$(VERSION_MICRO) -DFS_DEBUG
|
||||
CXXFLAGS = $(CFLAGS) -fno-rtti -std=gnu++17
|
||||
CFLAGS = -Os -Wall -ffast-math -Wno-narrowing -Wno-unused-variable \
|
||||
-DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_MICRO=$(VERSION_MICRO)
|
||||
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti -std=gnu++17
|
||||
ASFLAGS := $(CFLAGS)
|
||||
|
||||
BUILD_PRX = 1
|
||||
@ -25,10 +25,10 @@ PSP_LARGE_MEMORY = 1
|
||||
|
||||
LIBDIR = ../libs/lib
|
||||
LDFLAGS =
|
||||
LIBS = -lintrafont -lglib2d -lxmp-lite -lmpg123 -lvorbisfile -lvorbis -lopusfile -lopus -lFLAC -logg \
|
||||
-larchive -llzma -lturbojpeg -ljpeg -lpng16 -lstdc++ -lm -lz \
|
||||
LIBS = -lintrafont -lglib2d -lxmp -lmpg123 -lvorbisfile -lvorbis -lopusfile -lopus -lFLAC -logg \
|
||||
-larchive -llzma -ljpeg -lpng16 -lstdc++ -lz \
|
||||
-lpspkubridge -lpspsystemctrl_user -lpspusbdevice \
|
||||
-lpspgu -lpspvram -lpspaudio -lpsppower -lpsprtc -lpspreg -lpspusb -lpspusbstor -lpspumd
|
||||
-lpspgu -lpspvram -lpspaudio -lpsppower -lpspreg -lpspusb -lpspusbstor -lpspumd
|
||||
|
||||
EXTRA_TARGETS = EBOOT.PBP
|
||||
PSP_EBOOT_TITLE = CM File Manager PSP v$(VERSION_MAJOR).$(VERSION_MINOR)$(VERSION_MICRO)
|
||||
|
@ -142,18 +142,18 @@ namespace FS {
|
||||
|
||||
switch(time) {
|
||||
case FileCreatedTime:
|
||||
snprintf(timestamp, 30, "%d/%d/%d %2i:%02i", stat.st_ctime.year, stat.st_ctime.month, stat.st_ctime.day, stat.st_ctime.hour,
|
||||
stat.st_ctime.minute);
|
||||
snprintf(timestamp, 30, "%d/%d/%d %2i:%02i", stat.sce_st_ctime.year, stat.sce_st_ctime.month, stat.sce_st_ctime.day, stat.sce_st_ctime.hour,
|
||||
stat.sce_st_ctime.minute);
|
||||
break;
|
||||
|
||||
case FileAccessedTime:
|
||||
snprintf(timestamp, 30, "%d/%d/%d %2i:%02i", stat.st_atime.year, stat.st_atime.month, stat.st_atime.day, stat.st_atime.hour,
|
||||
stat.st_atime.minute);
|
||||
snprintf(timestamp, 30, "%d/%d/%d %2i:%02i", stat.sce_st_atime.year, stat.sce_st_atime.month, stat.sce_st_atime.day, stat.sce_st_atime.hour,
|
||||
stat.sce_st_atime.minute);
|
||||
break;
|
||||
|
||||
case FileModifiedTime:
|
||||
snprintf(timestamp, 30, "%d/%d/%d %2i:%02i", stat.st_mtime.year, stat.st_mtime.month, stat.st_mtime.day, stat.st_mtime.hour,
|
||||
stat.st_mtime.minute);
|
||||
snprintf(timestamp, 30, "%d/%d/%d %2i:%02i", stat.sce_st_mtime.year, stat.sce_st_mtime.month, stat.sce_st_mtime.day, stat.sce_st_mtime.hour,
|
||||
stat.sce_st_mtime.minute);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ static void cmd_PASV_func(ftppsp_client_info_t *client) {
|
||||
UNUSED(ret);
|
||||
|
||||
char cmd[54] = {0};
|
||||
unsigned int namelen;
|
||||
socklen_t namelen = 0;
|
||||
struct sockaddr_in picked;
|
||||
|
||||
/* Create the data socket */
|
||||
@ -182,7 +182,7 @@ static void cmd_PASV_func(ftppsp_client_info_t *client) {
|
||||
DEBUG("PASV mode port: 0x%04X\n", picked.sin_port);
|
||||
|
||||
/* Build the command */
|
||||
snprintf(cmd, 54, "227 Entering Passive Mode (%hhu,%hhu,%hhu,%hhu,%hhu,%hhu)\r\n",
|
||||
snprintf(cmd, 54, "227 Entering Passive Mode (%lu,%lu,%lu,%lu,%u,%u)\r\n",
|
||||
(psp_addr.s_addr >> 0) & 0xFF,
|
||||
(psp_addr.s_addr >> 8) & 0xFF,
|
||||
(psp_addr.s_addr >> 16) & 0xFF,
|
||||
@ -269,13 +269,13 @@ static int gen_list_format(char *out, int n, int dir, const SceIoStat *stat, con
|
||||
pspTime cdt;
|
||||
sceRtcGetCurrentClockLocalTime(&cdt);
|
||||
|
||||
if (cdt.year == stat->st_mtime.year)
|
||||
snprintf(yt, 12, "%02d:%02d", stat->st_mtime.hour, stat->st_mtime.minute);
|
||||
if (cdt.year == stat->sce_st_mtime.year)
|
||||
snprintf(yt, 12, "%02d:%02d", stat->sce_st_mtime.hour, stat->sce_st_mtime.minute);
|
||||
else
|
||||
snprintf(yt, 11, "%04d", stat->st_mtime.year);
|
||||
snprintf(yt, 11, "%04d", stat->sce_st_mtime.year);
|
||||
|
||||
return snprintf(out, n, "%c%s 1 psp psp %llu %s %-2d %s %s\r\n", dir ? 'd' : '-', dir ? "rwxr-xr-x" : "rw-r--r--",
|
||||
stat->st_size, num_to_month[stat->st_mtime.month<=0?0:(stat->st_mtime.month-1)%12], stat->st_mtime.day,
|
||||
stat->st_size, num_to_month[stat->sce_st_mtime.month<=0?0:(stat->sce_st_mtime.month-1)%12], stat->sce_st_mtime.day,
|
||||
yt, filename);
|
||||
}
|
||||
|
||||
|
@ -570,7 +570,7 @@ namespace GameLauncher {
|
||||
|
||||
char install_date[128] = {0};
|
||||
const char *months[] = { "Dec", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov" };
|
||||
snprintf(install_date, 128, "Installed %d %s %d", stat.st_ctime.day, months[stat.st_ctime.month], stat.st_ctime.year);
|
||||
snprintf(install_date, 128, "Installed %d %s %d", stat.sce_st_ctime.day, months[stat.sce_st_ctime.month], stat.sce_st_ctime.year);
|
||||
|
||||
int selection = 0;
|
||||
const char *metadata_types[] = { "< ICON0.PNG >", "< ICON1.PMF >", "< PIC0.PNG >", "< PIC1.PNG >", "< SND0.AT3 >" };
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include <assert.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <jpeglib.h>
|
||||
|
||||
#include "fs.h"
|
||||
#include "libnsbmp.h"
|
||||
@ -7,7 +9,6 @@
|
||||
#include "libpng/png.h"
|
||||
#include "log.h"
|
||||
#include "textures.h"
|
||||
#include "turbojpeg/turbojpeg.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define BYTES_PER_PIXEL 4
|
||||
@ -192,27 +193,28 @@ namespace Textures {
|
||||
}
|
||||
|
||||
g2dTexture *LoadImageBufferJPEG(unsigned char *data, int size) {
|
||||
int width = 0; int height = 0;
|
||||
unsigned char *buffer = nullptr;
|
||||
tjhandle jpeg = tjInitDecompress();
|
||||
int jpegsubsamp = 0;
|
||||
struct jpeg_decompress_struct info;
|
||||
struct jpeg_error_mgr err;
|
||||
|
||||
if (R_FAILED(tjDecompressHeader2(jpeg, data, size, &width, &height, &jpegsubsamp))) {
|
||||
Log::Error("tjDecompressHeader2 failed: %s\n", tjGetErrorStr());
|
||||
delete[] data;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
buffer = new unsigned char[width * height * 4];
|
||||
info.err = jpeg_std_error(&err);
|
||||
jpeg_create_decompress(&info);
|
||||
jpeg_mem_src(&info, data, size);
|
||||
jpeg_read_header(&info, TRUE);
|
||||
|
||||
if (R_FAILED(tjDecompress2(jpeg, data, size, buffer, width, 0, height, TJPF_RGBA, TJFLAG_FASTDCT))) {
|
||||
Log::Error("tjDecompress2 failed: %s\n", tjGetErrorStr());
|
||||
delete[] buffer;
|
||||
return nullptr;
|
||||
}
|
||||
info.out_color_space = JCS_EXT_RGBA;
|
||||
jpeg_start_decompress(&info);
|
||||
|
||||
u8 *buffer = new u8[info.output_width * info.output_height * 4];
|
||||
int stride = info.output_width * 4;
|
||||
|
||||
g2dTexture *tex = g2dTexLoad(buffer, width, height, G2D_SWIZZLE);
|
||||
tjDestroy(jpeg);
|
||||
while (info.output_scanline < info.output_height) {
|
||||
u8 *ptr = &buffer[stride * info.output_scanline];
|
||||
jpeg_read_scanlines(&info, &ptr, 1);
|
||||
}
|
||||
|
||||
jpeg_finish_decompress(&info);
|
||||
g2dTexture *tex = g2dTexLoad(buffer, info.output_width, info.output_height, G2D_SWIZZLE);
|
||||
jpeg_destroy_decompress(&info);
|
||||
delete[] buffer;
|
||||
return tex;
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
PSP_MODULE_INFO("CMFileManager Launcher", PSP_MODULE_USER, VERSION_MAJOR, VERSION_MINOR);
|
||||
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
|
||||
PSP_HEAP_SIZE_MAX();
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int ret = 0;
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user