diff --git a/README.md b/README.md index 79db514..f7f9f21 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ A simple NTP client for the Sony PlayStation Portable. This application changes the PSP's date and time using the ntp.org server. The application also uses a kernel level plugin to change the system's date and time (cannot be done in user mode), use at your own risk.
- +
# Credits -- [ntpclien by lettier](https://github.com/lettier/ntpclient) +- [ntpclient by lettier](https://github.com/lettier/ntpclient) diff --git a/app/Makefile b/app/Makefile index 60fd52a..b8885ee 100755 --- a/app/Makefile +++ b/app/Makefile @@ -4,15 +4,15 @@ SOURCES := data drivers source CFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.c)) SFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.S)) CPPFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.cpp)) -FONTFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.pgf)) +BMPFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.bmp)) GFXFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.png)) PRXFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.prx)) OBJS := $(addsuffix .o,$(BINFILES)) $(CFILES:.c=.o) $(SFILES:.S=.o) $(CPPFILES:.cpp=.o) \ - $(FONTFILES:.pgf=.o) $(GFXFILES:.png=.o) $(PRXFILES:.prx=.o) + $(BMPFILES:.bmp=.o) $(GFXFILES:.png=.o) $(PRXFILES:.prx=.o) VERSION_MAJOR := 1 -VERSION_MINOR := 0 +VERSION_MINOR := 1 INCDIR = ../libs/ ../libs/include include CFLAGS = -Os -G0 -Wall -ffast-math -Wno-narrowing -Wno-unused-variable \ @@ -34,8 +34,8 @@ PSP_EBOOT_TITLE = NTPSP v$(VERSION_MAJOR).$(VERSION_MINOR)$(VERSION_MICRO) PSPSDK=$(shell psp-config --pspsdk-path) include ./build.mak -%.o: %.pgf - bin2o -i $< $@ $(addsuffix _pgf, $(basename $(notdir $<) )) +%.o: %.bmp + bin2o -i $< $@ $(addsuffix _bmp, $(basename $(notdir $<) )) %.o: %.png bin2o -i $< $@ $(addsuffix _png, $(basename $(notdir $<) )) diff --git a/app/data/backgrounds.bmp b/app/data/backgrounds.bmp new file mode 100644 index 0000000..f6a258e Binary files /dev/null and b/app/data/backgrounds.bmp differ diff --git a/app/source/crt0.c b/app/source/crt0.c index 49d62e7..6afbe6e 100755 --- a/app/source/crt0.c +++ b/app/source/crt0.c @@ -23,8 +23,9 @@ int SetupCallbacks(void) { } int thid = sceKernelCreateThread("NTPSP_callback_thread", CallbackThread, 0x11, 0xFA0, 0, 0); - if (thid >= 0) + if (thid >= 0) { sceKernelStartThread(thid, 0, 0); + } return thid; } @@ -51,8 +52,9 @@ int start_thread(SceSize args, void *argp) { last_trail = i; } - if (last_trail >= 0) + if (last_trail >= 0) { path[last_trail] = 0; + } sceIoChdir(path); path[last_trail] = '/'; @@ -70,8 +72,9 @@ int module_start(SceSize args, void *argp) { SetupCallbacks(); SceUID thread = sceKernelCreateThread("NTPSP_start_thread", start_thread, 0x10, 0x4000, 0, NULL); - if (thread < 0) + if (thread < 0) { return thread; + } sceKernelStartThread(thread, args, argp); return 0; diff --git a/app/source/main.c b/app/source/main.c index 6145bce..ebf095d 100755 --- a/app/source/main.c +++ b/app/source/main.c @@ -12,10 +12,11 @@ PSP_MODULE_INFO("NTPSP", PSP_MODULE_USER, VERSION_MAJOR, VERSION_MINOR); PSP_MAIN_THREAD_ATTR(0); -extern unsigned char logo_png_start[]; -extern unsigned int logo_png_size; +extern unsigned char backgrounds_bmp_start[], logo_png_start[]; +extern unsigned int backgrounds_bmp_size, logo_png_size; char g_err_string[64]; +static const int colour = 12; static char g_message_text[128]; static pspTime g_psp_time_ntp = { 0 }; static VlfText g_title_text; @@ -27,7 +28,7 @@ static void vlfSetTitle(char *fmt, ...) { char text[64]; va_start(list, fmt); - vsprintf(text, fmt, list); + vsnprintf(text, 64, fmt, list); va_end(list); if (g_title_text != NULL) @@ -37,8 +38,8 @@ static void vlfSetTitle(char *fmt, ...) { vlfGuiRemovePicture(g_title_pic); g_title_text = vlfGuiAddText(0, 0, text); - g_title_pic = vlfGuiAddPictureResource("ps3scan_plugin.rco", "tex_infobar_icon", 4, -2); - vlfGuiSetTitleBar(g_title_text, g_title_pic, 1, 0); + g_title_pic = vlfGuiAddPictureResource("netconf_dialog.rco", "tex_netconf_icon", 4, -2); + vlfGuiSetTitleBarEx(g_title_text, g_title_pic, 1, 0, colour); } int menuSelection(int selection) { @@ -104,9 +105,10 @@ int app_main(int argc, char *argv[]) { char *item_labels[] = { "Sync Clock", "Exit" }; vlfGuiSystemSetup(1, 1, 1); + vlfGuiSetBackgroundFileBuffer(backgrounds_bmp_start + colour * 6176, 6176, 1); vlfSetTitle("NTPSP v%d.%d", VERSION_MAJOR, VERSION_MINOR); g_logo_pic = vlfGuiAddPicture(logo_png_start, logo_png_size, 45, 36); - vlfGuiLateralMenu(num_menu_items, item_labels, 0, menuSelection, 120); + vlfGuiLateralMenuEx(num_menu_items, item_labels, 0, menuSelection, 120, colour); while (g_running) { vlfGuiDrawFrame();