Optimization phase 2

This commit is contained in:
owendswang committed 2026-07-29 23:12:49 +08:00
1 parent 2dc1ff2c42
commit ae23c8fdaf
5 files changed
+17 -4

No files matched your search

+1 -1
View File
@@ -4,4 +4,4 @@ web-file-mgr-linux
*.o
*.d
tools/
test/
test/
+8 -3
View File
@@ -27,10 +27,15 @@ LINUX_BIN := web-file-mgr-linux
COMMON_SRCS := src/main.c src/websrv.c src/filemgr.c src/file_response.c src/task.c src/upload.c src/download.c src/text.c src/list.c src/space.c src/fs_util.c src/json_util.c src/path_util.c src/asset.c src/mime.c src/notify.c
PS5_SRCS := $(COMMON_SRCS) src/app_installer.c
LINUX_SRCS := $(COMMON_SRCS)
ASSETS := $(wildcard assets/*)
BASE_ASSETS := $(filter-out %.dds,$(wildcard assets/*))
ifneq ($(filter linux,$(MAKECMDGOALS)),)
ASSETS := $(BASE_ASSETS)
else
ASSETS := $(filter-out assets/icon0.png,$(BASE_ASSETS))
endif
GEN_SRCS := $(patsubst assets/%,gen/%, $(ASSETS:=.c))
CFLAGS := -Oz -flto -fno-asynchronous-unwind-tables -fno-unwind-tables -Wall -Werror -ffunction-sections -fdata-sections -Isrc -DVERSION_TAG=\"$(VERSION_TAG)\" -DTITLE_ID=\"$(TITLE_ID)\"
CFLAGS := -Oz -fno-asynchronous-unwind-tables -fno-unwind-tables -Wall -Werror -ffunction-sections -fdata-sections -Isrc -DVERSION_TAG=\"$(VERSION_TAG)\" -DTITLE_ID=\"$(TITLE_ID)\"
CFLAGS += `$(PKG_CONFIG) libmicrohttpd --cflags`
LDFLAGS := -Wl,--gc-sections
LDADD := `$(PKG_CONFIG) libmicrohttpd --libs`
@@ -62,7 +67,7 @@ gen/%.c: assets/% gen-asset-module.py | gen
$(PYTHON) gen-asset-module.py --path $* $< > $@
$(BIN): $(PS5_SRCS) $(GEN_SRCS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDADD)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LDADD)
$(STRIP) $@
$(LINUX_BIN): $(LINUX_SRCS) $(GEN_SRCS)
+1
View File
@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PS5 Web File Manager</title>
<link rel="icon" type="image/png" href="/icon0.png">
<style>
html, body { margin: 0; min-height: 100%; background: #111316; color: #edf0f2; }
.init-loading {
+4
View File
@@ -8,6 +8,8 @@
#include <ps5/kernel.h>
#include "asset.h"
#define INCASSET(name, file) \
__asm__(".section .rodata\n" \
".global " #name "\n" \
@@ -90,6 +92,8 @@ app_install_if_needed(void) {
int update_needed = 0;
int err;
asset_register("/icon0.png", icon0_png, icon0_png_size, "image/png", 0);
snprintf(base_dir, sizeof(base_dir), "/user/app/%s", title_id);
snprintf(sce_sys_dir, sizeof(sce_sys_dir), "/user/app/%s/sce_sys", title_id);
snprintf(param_path, sizeof(param_path), "%s/param.json", sce_sys_dir);
+3
View File
@@ -129,6 +129,9 @@ websrv_on_request(void *cls, struct MHD_Connection *conn, const char *url,
if(!strcmp(url, "/") || !url[0]) {
return asset_request(conn, "/index.html");
}
if(!strcmp(url, "/favicon.ico")) {
return asset_request(conn, "/icon0.png");
}
return asset_request(conn, url);
}