app: Remove compile.sh, clean up makefiles, make use of #pragma once and re-order includes

This commit is contained in:
Joel16 2022-07-23 23:03:08 -04:00
parent 696dca9694
commit d504c07927
40 changed files with 321 additions and 153 deletions

5
.gitignore vendored
View File

@ -35,13 +35,15 @@
*.i*86
*.x86_64
*.hex
*.PBP
app/*.prx
app/*.SFO
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
*.PBP
# Kernel Module Compile Results
*.mod*
@ -51,3 +53,4 @@ modules.order
Module.symvers
Mkfile.old
dkms.conf
app/drivers

View File

@ -1,26 +1,7 @@
TARGET = EVEREST
OBJS = source/crt0.o source/main.o source/utils.o source/hardware_utils.o source/system_utils.o \
source/consoleid_utils.o source/translate.o source/imports.o everest_kernel/everest_kernel.o \
kumdman/pspUmdMan_driver.o
SUBDIRS = plugin/everest_kernel plugin/kumdman app
INCDIR = libs/include include
CFLAGS = -O2 -G0 -Wall -fshort-wchar -fno-pic -mno-check-zero-division
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS) -c
all:
@for dir in $(SUBDIRS); do $(MAKE) -C $$dir; done
LDFLAGS = -nostdlib -nodefaultlibs
LIBDIR = libs/lib
STDLIBS = -lpspmodinfo -lpspopenpsid -lpsprtc -lvlfgui -lvlfgu -lvlfutils -lvlflibc -lpsppower -lpspkubridge
LIBS = $(STDLIBS) -lpspreg
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = PSP EVEREST 2 Rev6
PSP_EBOOT_ICON = ICON0.PNG
PSP_EBOOT_PIC1 = PIC1.png
BUILD_PRX = 1
PSP_LARGE_MEMORY = 1
PSPSDK = $(shell psp-config --pspsdk-path)
include ./build.mak
clean:
@for dir in $(SUBDIRS); do $(MAKE) clean -C $$dir; done

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

35
app/Makefile Normal file
View File

@ -0,0 +1,35 @@
TARGET = EVEREST
SOURCES := data drivers source
CFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.c))
SFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.S))
GFXFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.bmp))
PRXFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.prx))
OBJS := $(addsuffix .o,$(BINFILES)) $(CFILES:.c=.o) $(SFILES:.S=.o) $(GFXFILES:.bmp=.o) $(PRXFILES:.prx=.o)
INCDIR = ../libs/ ../libs/include include
CFLAGS = -O2 -G0 -Wall -fshort-wchar -fno-pic -mno-check-zero-division
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS) -c
BUILD_PRX = 1
PSP_LARGE_MEMORY = 1
LIBDIR = ../libs/lib
LDFLAGS = -nostdlib -nodefaultlibs
LIBS = -lpspmodinfo -lpspopenpsid -lpsprtc -lpsppower -lpspreg -lpspkubridge -lvlfgui -lvlfgu -lvlfutils -lvlflibc
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = PSP EVEREST 2 Rev6
PSP_EBOOT_ICON = ICON0.PNG
PSP_EBOOT_PIC1 = PIC1.png
PSPSDK=$(shell psp-config --pspsdk-path)
include ./build.mak
%.o: %.bmp
bin2o -i $< $@ $(addsuffix _bmp, $(basename $(notdir $<) ))
%.o: %.prx
bin2o -i $< $@ $(addsuffix _prx, $(basename $(notdir $<) ))

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 217 KiB

After

Width:  |  Height:  |  Size: 217 KiB

BIN
app/data/everest_kernel.prx Normal file

Binary file not shown.

BIN
app/data/kumdman.prx Normal file

Binary file not shown.

View File

@ -1,5 +1,4 @@
#ifndef ___KPSPIDENT_H___
#define ___KPSPIDENT_H___
#pragma once
/**
* This structure contains console specific information. It is a subset of the ::SceConsoleId.
@ -36,5 +35,3 @@ int pspWriteSerial(u16* serial);
int pspChkregGetPsCode(ScePsCode *pPsCode);
int pspSysconBatteryGetElec(int *elec);
int pspSysconBatteryGetTotalElec(int *elec);
#endif

View File

@ -1,5 +1,4 @@
#ifndef ___HARDWARE_UTILS_H___
#define ___HARDWARE_UTILS_H___
#pragma once
int pspGetFirstSymbolOfModel(void);
const char *pspGetRegionName(void);
@ -7,5 +6,3 @@ char *pspGetMoBoName(void);
char *pspGetUMDFWText(void);
char *pspGetMacAddressText(void);
const char *pspGetModelName(void);
#endif

View File

@ -1,5 +1,4 @@
#ifndef ___KUMDMAN_H___
#define ___KUMDMAN_H___
#pragma once
extern char outtxt[0x12];
@ -21,5 +20,3 @@ extern u8 param[4];
void *pspUmdManGetUmdDrive(int driveNum);
int pspUmdExecInquiryCmd(void *drive, u8 *param, u8 *buf);
#endif

View File

@ -1,9 +1,4 @@
#ifndef ___MAIN_H___
#define ___MAIN_H___
#include "vlf.h"
#pragma once
extern int psp_model, devkit, language;
extern s32 tachyon, baryon, pommel;
#endif

View File

@ -0,0 +1,4 @@
#pragma once
char *pspGetFirmwareName(void);
char *pspGetVersionTxt(void);

View File

@ -1,5 +1,4 @@
#ifndef __TRANSLATE_H__
#define __TRANSLATE_H__
#pragma once
struct HardwareInformation {
const char *model;
@ -73,5 +72,3 @@ typedef struct _EverestTranslate {
extern EverestTranslate *trans;
void SetupTranslate(void);
#endif

View File

@ -1,9 +1,8 @@
#ifndef ___UTILS_H___
#define ___UTILS_H___
#pragma once
#include "vlf.h"
int GetRegistryValue(const char *dir, const char *name, void *buf, int bufsize, int inttype);
int Random(int min, int max);
int utf82unicode(wchar_t *dest, char *src);
VlfText pspEverestPrintf(int x, int y, const char *text, ...);
#endif

View File

@ -1,16 +1,15 @@
#include <pspsdk.h>
#include <kubridge.h>
#include <pspkernel.h>
#include <pspsdk.h>
#include <psputility_sysparam.h>
#include <string.h>
#include <stdio.h>
#include <vlf.h>
#include <kubridge.h>
#include <psputility_sysparam.h>
#include "main.h"
#include "everest_kernel_prx.h"
#include "kumdman_prx.h"
#include "intraFont_prx.h"
#include "vlf_prx.h"
extern unsigned char everest_kernel_prx_start[], intraFont_prx_start[], kumdman_prx_start[], vlf_prx_start[];
extern unsigned int everest_kernel_prx_size, intraFont_prx_size, kumdman_prx_size, vlf_prx_size;
extern int app_main(int argc, char *argv[]);
@ -34,8 +33,8 @@ int SetupCallbacks(void) {
return thid;
}
void LoadStartModuleBuffer(char *path, char *buf, int size, SceSize args, void *argp) {
SceUID mod, out;
void LoadStartModuleBuffer(const char *path, const void *buf, int size, SceSize args, void *argp) {
SceUID mod = 0, out = 0;
sceIoRemove(path);
out = sceIoOpen(path, PSP_O_WRONLY | PSP_O_CREAT, 0777);
@ -63,13 +62,13 @@ int start_thread(SceSize args, void *argp) {
path[last_trail] = '/';
if (psp_model != 4)
LoadStartModuleBuffer("kumdman.prx", (void *)kumdman_prx, size_kumdman_prx, args, argp);
LoadStartModuleBuffer("everest_kernel.prx", (void *)everest_kernel_prx, size_everest_kernel_prx, args, argp);
LoadStartModuleBuffer("intraFont.prx", (void *)intraFont_prx, size_intraFont_prx, args, argp);
strcpy((void *)vlf_prx + 0x6D678, "flash0:/font/ltn0.pgf");//WARNING: Path for font not be more 23 characters!
LoadStartModuleBuffer("vlf.prx", (void *)vlf_prx, size_vlf_prx, args, argp);
LoadStartModuleBuffer("kumdman.prx", kumdman_prx_start, kumdman_prx_size, args, argp);
strcpy((char *)vlf_prx_start + 0x6D678, "flash0:/font/ltn0.pgf"); // WARNING: Path for font not be more 23 characters!
LoadStartModuleBuffer("everest_kernel.prx", everest_kernel_prx_start, everest_kernel_prx_size, args, argp);
LoadStartModuleBuffer("intraFont.prx", intraFont_prx_start, intraFont_prx_size, args, argp);
LoadStartModuleBuffer("vlf.prx", vlf_prx_start, vlf_prx_size, args, argp);
vlfGuiInit(-1, app_main);
return sceKernelExitDeleteThread(0);
}

View File

@ -1,5 +1,5 @@
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspsdk.h>
#include <string.h>
#include <stdio.h>

View File

@ -12,18 +12,16 @@
#include <stdio.h>
#include <string.h>
#include "main.h"
#include "vlf.h"
#include "utils.h"
#include "backgrounds_bmp.h"
#include "consoleid_utils.h"
#include "everest_kernel.h"
#include "hardware_utils.h"
#include "main.h"
#include "system_utils.h"
#include "consoleid_utils.h"
#include "translate.h"
#include "utils.h"
#include "vlf.h"
PSP_MODULE_INFO("PSP_EVEREST", 0, 2, 0);
PSP_MODULE_INFO("PSP EVEREST 2 Rev6", 0, 2, 0);
PSP_MAIN_THREAD_ATTR(0);
#define NUM_DEL_ITEMS_MAIN 5
@ -35,6 +33,9 @@ PSP_MAIN_THREAD_ATTR(0);
#define EVE_ENTER_EN "Enter"
#define EVE_BACK_EN "Back"
extern unsigned char backgrounds_bmp_start[];
extern unsigned int backgrounds_bmp_size;
VlfText main_menu[NUM_DEL_ITEMS_MAIN], text_hardware[NUM_DEL_ITEMS_HARDWARE], text_battery[NUM_DEL_ITEMS_BATTERY],
text_system[NUM_DEL_ITEMS_SYSTEM], text_consoleId[NUM_DEL_ITEMS_CONSOLEID], title_text;
VlfPicture title_pic, pic_button_assign;
@ -91,7 +92,7 @@ void SetBackground(void) {
else if (background_number > max_background_number)
background_number = 0;
vlfGuiSetBackgroundFileBuffer(backgrounds_bmp + background_number * 6176, 6176, 1);
vlfGuiSetBackgroundFileBuffer(backgrounds_bmp_start + background_number * 6176, 6176, 1);
SetFade();
}
@ -434,7 +435,7 @@ int app_main(int argc, char *argv[]) {
vlfGuiAddEventHandler(PSP_CTRL_RTRIGGER, -1, OnBackgroundPlus, NULL);
vlfGuiAddEventHandler(PSP_CTRL_LTRIGGER, -1, OnBackgroundMinus, NULL);
max_background_number = size_backgrounds_bmp / 6176 - 1;
max_background_number = backgrounds_bmp_size / 6176 - 1;
background_number = Random(0, max_background_number);
SetBackground();

View File

@ -1,5 +1,5 @@
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspsdk.h>
#include <systemctrl.h>
#include <string.h>
#include <stdio.h>

View File

@ -1,12 +1,13 @@
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspreg.h>
#include <psprtc.h>
#include <pspsdk.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <pspreg.h>
#include <psprtc.h>
#include "main.h"
#include "vlf.h"
int GetRegistryValue(const char *dir, const char *name, void *buf, int bufsize, int inttype) {
int ret = 0;

View File

@ -1,24 +0,0 @@
#!/bin/sh
cd everest_kernel
make clean && make
psp-build-exports -s exports.exp
bin2c everest_kernel.prx ../everest_kernel_prx.h everest_kernel_prx
rm *.o *.elf *.prx
cd ../kumdman
make clean && make
psp-build-exports -s exports.exp
bin2c kumdman.prx ../kumdman_prx.h kumdman_prx
rm *.o *.elf *.prx
cd ../PRXs
bin2c intraFont.prx ../intraFont_prx.h intraFont_prx
bin2c vlf.prx ../vlf_prx.h vlf_prx
cd ..
rm *.PBP
bin2c backgrounds.bmp backgrounds_bmp.h backgrounds_bmp
make clean && make
rm *.o *.prx *.elf *.SFO backgrounds_bmp.h everest_kernel_prx.h kumdman_prx.h intraFont_prx.h vlf_prx.h
rm everest_kernel/everest_kernel.S everest_kernel/everest_kernel.o kumdman/pspUmdMan_driver.S kumdman/pspUmdMan_driver.o

View File

@ -1,17 +0,0 @@
TARGET = everest_kernel
OBJS = main.o imports.o
INCDIR = ../include ../libs/include
CFLAGS = -O2 -G0 -Wall -fno-pic
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
BUILD_PRX = 1
PRX_EXPORTS = exports.exp
LDFLAGS = -nostartfiles
LIBS = -lpspkernel -lpspnand_driver -lpspwlan
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak

View File

@ -1,7 +0,0 @@
#ifndef ___SYSTEM_UTILS_H___
#define ___SYSTEM_UTILS_H___
char *pspGetFirmwareName(void);
char *pspGetVersionTxt(void);
#endif

View File

@ -1,21 +0,0 @@
TARGET = kumdman
OBJS = main.o sceUmdMan_driver.o exports.o
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS) -c
BUILD_PRX = 1
PRX_EXPORTS = exports.exp
USE_KERNEL_LIBC = 1
USE_KERNEL_LIBS = 1
LIBDIR =
LDFLAGS =
LIBS =
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak

182
libs/include/kubridge.h Normal file
View File

@ -0,0 +1,182 @@
#ifndef __KULIBRARY__
#define __KULIBRARY__
#if defined (__cplusplus)
extern "C" {
#endif
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspsysmem_kernel.h>
#include <pspctrl.h>
/**
* Functions to let user mode access certain functions only available in
* kernel mode
*/
/**
* Load a module using ModuleMgrForKernel.
*
* @param path - The path to the module to load.
* @param flags - Unused, always 0 .
* @param option - Pointer to a mod_param_t structure. Can be NULL.
*
* @returns The UID of the loaded module on success, otherwise one of ::PspKernelErrorCodes.
*/
SceUID kuKernelLoadModule(const char *path, int flags, SceKernelLMOption *option);
/**
* Load a module with a specific apitype
*
* @param ap<EFBFBD>type - The apitype
* @param path - The path to the module to load.
* @param flags - Unused, always 0 .
* @param option - Pointer to a mod_param_t structure. Can be NULL.
*
* @returns The UID of the loaded module on success, otherwise one of ::PspKernelErrorCodes.
*/
SceUID kuKernelLoadModuleWithApitype2(int apitype, const char *path, int flags, SceKernelLMOption *option);
/**
* Gets the api type
*
* @returns the api type in which the system has booted
*/
int kuKernelInitApitype();
/**
* Gets the filename of the executable to be launched after all modules of the api.
*
* @param initfilename - String where copy the initfilename
* @returns 0 on success
*/
int kuKernelInitFileName(char *initfilename);
/**
*
* Gets the device in which the application was launched.
*
* @returns the device code, one of PSPBootFrom values.
*/
int kuKernelBootFrom();
/**
* Get the key configuration in which the system has booted.
*
* @returns the key configuration code, one of PSPKeyConfig values
*/
int kuKernelInitKeyConfig();
/**
* Get the user level of the current thread
*
* @return The user level, < 0 on error
*/
int kuKernelGetUserLevel(void);
/**
* Set the protection of a block of ddr memory
*
* @param addr - Address to set protection on
* @param size - Size of block
* @param prot - Protection bitmask
*
* @return < 0 on error
*/
int kuKernelSetDdrMemoryProtection(void *addr, int size, int prot);
/**
* Gets the model of the PSP from user mode.
* This function is available since 3.60 M33.
* In previous version, use the kernel function sceKernelGetModel
*
* @return one of PspModel values
*/
int kuKernelGetModel(void);
/**
* Find module by name
*
* @param modname - Name of Module
* @param mod - module structure for output (actually treated as SceModule2)
*
* @return < 0 on error
*/
int kuKernelFindModuleByName(char *modname, SceModule *mod);
/**
* Invalidate the entire instruction cache
*/
void kuKernelIcacheInvalidateAll(void);
/**
* Read 4 bytes from memory (with kernel memory access)
*
* @param addr - Address to read, must have 4 bytes alignment
*/
u32 kuKernelPeekw(void *addr);
/**
* Write 4 bytes to memory (with kernel memory access)
*
* @param addr - Address to write, must have 4 bytes alignment
*/
void kuKernelPokew(void *addr, u32 value);
/**
* memcpy (with kernel memory access)
*
* @param dest - Destination address
* @param src - Source address
* @param num - copy bytes count
*
* @return Destination address
*/
void *kuKernelMemcpy(void *dest, const void *src, size_t num);
struct KernelCallArg {
u32 arg1;
u32 arg2;
u32 arg3;
u32 arg4;
u32 arg5;
u32 arg6;
u32 arg7;
u32 arg8;
u32 arg9;
u32 arg10;
u32 arg11;
u32 arg12;
u32 ret1;
u32 ret2;
};
/**
* Call a kernel function with kernel privilege
*
* @param func_addr - kernel function address
* @param args - kernel arguments and return values
*
* return < 0 on error
*/
int kuKernelCall(void *func_addr, struct KernelCallArg *args);
/**
* Call a kernel function with kernel privilege and extended stack
*
* @param func_addr - kernel function address
* @param args - kernel arguments and return values
*
* return < 0 on error
*/
int kuKernelCallExtendStack(void *func_addr, struct KernelCallArg *args, int stack_size);
void kuKernelGetUmdFile(char *umdfile, int size);
#if defined (__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,25 @@
TARGET = everest_kernel
OBJS = everest_kernel.o imports.o exports.o
PRX_EXPORTS = exports.exp
# Use the kernel's small inbuilt libc
USE_KERNEL_LIBC = 1
# Use only kernel libraries
USE_KERNEL_LIBS = 1
INCDIR = ../../app/include ../../libs/include
CFLAGS = -Os -G0 -Wall -fno-builtin-printf
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LDFLAGS = -nostartfiles
LIBS = -lpspkernel -lpspnand_driver -lpspwlan
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak
all:
psp-build-exports -s $(PRX_EXPORTS)
mkdir "../../app/data/"; mv everest_kernel.prx "../../app/data/"
mkdir "../../app/drivers/"; mv everest_kernel.S "../../app/drivers/"

View File

@ -11,7 +11,7 @@
#include "systemctrl.h"
#include "everest_kernel.h"
PSP_MODULE_INFO("EVEREST_KERNEL", 0x1006, 7, 4);
PSP_MODULE_INFO("everest_kernel", 0x1006, 7, 4);
PSP_MAIN_THREAD_ATTR(0);
#define MAKE_CALL(f) (0x0C000000 | (((u32)(f) >> 2) & 0x03ffffff))

24
plugin/kumdman/Makefile Normal file
View File

@ -0,0 +1,24 @@
TARGET = kumdman
OBJS = kumdman.o sceUmdMan_driver.o exports.o
PRX_EXPORTS = exports.exp
# Use the kernel's small inbuilt libc
USE_KERNEL_LIBC = 1
# Use only kernel libraries
USE_KERNEL_LIBS = 1
INCDIR =
CFLAGS = -Os -G0 -Wall -fno-builtin-printf
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LDFLAGS = -nostartfiles
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak
all:
psp-build-exports -s $(PRX_EXPORTS)
mkdir "../../app/data/"; mv kumdman.prx "../../app/data/"
mkdir "../../app/drivers/"; mv kumdman.S "../../app/drivers/"

View File

@ -4,7 +4,7 @@ PSP_BEGIN_EXPORTS
PSP_EXPORT_VAR_HASH(module_info)
PSP_EXPORT_END
PSP_EXPORT_START(pspUmdMan_driver, 0, 0x4001)
PSP_EXPORT_START(kumdman, 0, 0x4001)
PSP_EXPORT_FUNC_HASH(pspUmdExecInquiryCmd)
PSP_EXPORT_FUNC_HASH(pspUmdManGetUmdDrive)
PSP_EXPORT_END

View File

@ -1,7 +1,7 @@
#include <pspsdk.h>
#include <pspkernel.h>
PSP_MODULE_INFO("pspUmdMan_Driver", 0x1000, 1, 0);
PSP_MODULE_INFO("kumdman", PSP_MODULE_KERNEL, 1, 0);
PSP_MAIN_THREAD_ATTR(0);
int sceUmdManGetUmdDrive(int driveNum);