Skip to content

Commit

Permalink
add github action building against 4.01 m33 sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
Kethen committed Dec 30, 2024
1 parent 118be0c commit dec6f4b
Show file tree
Hide file tree
Showing 29 changed files with 1,905 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build_m33.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build package for 4.01 m33

on: [ push, pull_request, workflow_dispatch ]

# written referencing apollo save tool psp's CI

jobs:
build_pkg:
runs-on: ubuntu-22.04
steps:

- name: Checkout
uses: actions/checkout@v3

# install latest pspdev sdk
- name: Download PSP SDK
run: |
curl -sL https://github.com/pspdev/pspdev/releases/download/v20240701/pspdev-ubuntu-latest-x86_64.tar.gz | tar xvz -C ./
- name: Set env vars
run: |
echo "sha_name=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV
echo "PSPDEV=${GITHUB_WORKSPACE}/pspdev" >> $GITHUB_ENV
echo "${GITHUB_WORKSPACE}/pspdev/bin" >> $GITHUB_PATH
- name: Build GTRemastered.prx
run: |
cp m33_sdk_prebuilt/include/* pspdev/psp/sdk/include/
cp m33_sdk_prebuilt/lib/* pspdev/psp/sdk/lib/
make
- name: Push package artifact
uses: actions/upload-artifact@v3
with:
name: GTRemastered_4.01m33_${{ env.sha_name }}
path: |
GTRemastered.prx
plugin.ini
if-no-files-found: error
1 change: 1 addition & 0 deletions m33_sdk_prebuilt/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
obtained from https://gbatemp.net/download/custom-firmware-cfw-4-01-m33.37679/
98 changes: 98 additions & 0 deletions m33_sdk_prebuilt/include/kubridge.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#ifndef __KULIBRARY__

#define __KULIBRARY__

#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ì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);


#endif

64 changes: 64 additions & 0 deletions m33_sdk_prebuilt/include/pspinit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#ifndef __PSPINIT_H__

#define __PSPINIT_H__

enum PSPBootFrom
{
PSP_BOOT_FLASH = 0, /* ? */
PSP_BOOT_DISC = 0x20,
PSP_BOOT_MS = 0x40,
};

enum PSPInitApitype
{
PSP_INIT_APITYPE_DISC = 0x120,
PSP_INIT_APITYPE_DISC_UPDATER = 0x121,
PSP_INIT_APITYPE_MS1 = 0x140,
PSP_INIT_APITYPE_MS2 = 0x141,
PSP_INIT_APITYPE_MS3 = 0x142,
PSP_INIT_APITYPE_MS4 = 0x143,
PSP_INIT_APITYPE_MS5 = 0x144,
PSP_INIT_APITYPE_VSH1 = 0x210, /* ExitGame */
PSP_INIT_APITYPE_VSH2 = 0x220, /* ExitVSH */
};

enum PSPKeyConfig
{
PSP_INIT_KEYCONFIG_VSH = 0x100,
PSP_INIT_KEYCONFIG_GAME = 0x200,
PSP_INIT_KEYCONFIG_POPS = 0x300,
};

/**
* Gets the api type
*
* @returns the api type in which the system has booted
*/
int sceKernelInitApitype();

/**
* Gets the filename of the executable to be launched after all modules of the api.
*
* @returns filename of executable or NULL if no executable found.
*/
char *sceKernelInitFileName();

/**
*
* Gets the device in which the application was launched.
*
* @returns the device code, one of PSPBootFrom values.
*/
int sceKernelBootFrom();

/**
* Get the key configuration in which the system has booted.
*
* @returns the key configuration code, one of PSPKeyConfig values
*/
int InitForKernel_7233B5BC();

#define sceKernelInitKeyConfig InitForKernel_7233B5BC

#endif

185 changes: 185 additions & 0 deletions m33_sdk_prebuilt/include/psploadcore.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
/*
* PSP Software Development Kit - http://www.pspdev.org
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* psploadcore.h - Interface to LoadCoreForKernel.
*
* Copyright (c) 2005 Marcus R. Brown <[email protected]>
* Copyright (c) 2005 James Forshaw <[email protected]>
* Copyright (c) 2005 John Kelley <[email protected]>
*
* $Id: psploadcore.h 1095 2005-09-27 21:02:16Z jim $
*/

#ifndef PSPLOADCORE_H
#define PSPLOADCORE_H

#include <pspkerneltypes.h>

/** @defgroup LoadCore Interface to the LoadCoreForKernel library.
*/

#ifdef __cplusplus
extern "C" {
#endif

/** @addtogroup LoadCore Interface to the LoadCoreForKernel library. */
/*@{*/

/** Describes a module. This structure could change in future firmware revisions. */
typedef struct SceModule {
struct SceModule *next;
unsigned short attribute;
unsigned char version[2];
char modname[27];
char terminal;
unsigned int unknown1;
unsigned int unknown2;
SceUID modid;
unsigned int unknown3[4];
void * ent_top;
unsigned int ent_size;
void * stub_top;
unsigned int stub_size;
unsigned int unknown4[4];
unsigned int entry_addr;
unsigned int gp_value;
unsigned int text_addr;
unsigned int text_size;
unsigned int data_size;
unsigned int bss_size;
unsigned int nsegment;
unsigned int segmentaddr[4];
unsigned int segmentsize[4];
} SceModule;

// For 1.50+

typedef struct SceModule2
{
struct SceModule *next; // 0
u16 attribute; // 4
u8 version[2]; // 6
char modname[27]; // 8
char terminal; // 0x23
char mod_state; // 0x24
char unk1; // 0x25
char unk2[2]; // 0x26
u32 unk3; // 0x28
SceUID modid; // 0x2C
u32 unk4; // 0x30
SceUID mem_id; // 0x34
u32 mpid_text; // 0x38
u32 mpid_data; // 0x3C
void * ent_top; // 0x40
unsigned int ent_size; // 0x44
void * stub_top; // 0x48
u32 stub_size; // 0x4C
u32 entry_addr_; // 0x50
u32 unk5[4]; // 0x54
u32 entry_addr; // 0x64
u32 gp_value; // 0x68
u32 text_addr; // 0x6C
u32 text_size; // 0x70
u32 data_size; // 0x74
u32 bss_size; // 0x78
u32 nsegment; // 0x7C
u32 segmentaddr[4]; // 0x80
u32 segmentsize[4]; // 0x90
} SceModule2;

/** Defines a library and its exported functions and variables. Use the len
member to determine the real size of the table (size = len * 4). */
typedef struct SceLibraryEntryTable {
/**The library's name. */
const char * libname;
/** Library version. */
unsigned char version[2];
/** Library attributes. */
unsigned short attribute;
/** Length of this entry table in 32-bit WORDs. */
unsigned char len;
/** The number of variables exported by the library. */
unsigned char vstubcount;
/** The number of functions exported by the library. */
unsigned short stubcount;
/** Pointer to the entry table; an array of NIDs followed by
pointers to functions and variables. */
void * entrytable;
} SceLibraryEntryTable;

/** Specifies a library and a set of imports from that library. Use the len
member to determine the real size of the table (size = len * 4). */
typedef struct SceLibraryStubTable {
/* The name of the library we're importing from. */
const char * libname;
/** Minimum required version of the library we want to import. */
unsigned char version[2];
/* Import attributes. */
unsigned short attribute;
/** Length of this stub table in 32-bit WORDs. */
unsigned char len;
/** The number of variables imported from the library. */
unsigned char vstubcount;
/** The number of functions imported from the library. */
unsigned short stubcount;
/** Pointer to an array of NIDs. */
unsigned int * nidtable;
/** Pointer to the imported function stubs. */
void * stubtable;
/** Pointer to the imported variable stubs. */
void * vstubtable;
} SceLibraryStubTable;


/**
* Find a module by it's name.
*
* @param modname - The name of the module.
*
* @returns Pointer to the ::SceModule structure if found, otherwise NULL.
*/
//SceModule * sceKernelFindModuleByName(const char *modname);
SceModule2 *sceKernelFindModuleByName(const char *modname);

/**
* Find a module from an address.
*
* @param addr - Address somewhere within the module.
*
* @returns Pointer to the ::SceModule structure if found, otherwise NULL.
*/
//SceModule * sceKernelFindModuleByAddress(unsigned int addr);
SceModule2 *sceKernelFindModuleByAddress(unsigned int addr);

/**
* Find a module by it's UID.
*
* @param modid - The UID of the module.
*
* @returns Pointer to the ::SceModule structure if found, otherwise NULL.
*/
//SceModule * sceKernelFindModuleByUID(SceUID modid);
SceModule2 *sceKernelFindModuleByUID(SceUID modid);


/**
* Return the count of loaded modules.
*
* @returns The count of loaded modules.
*/
int sceKernelModuleCount(void);

/**
* Invalidate the CPU's instruction cache.
*/
void sceKernelIcacheClearAll(void);

/*@}*/

#ifdef __cplusplus
}
#endif

#endif /* PSPLOADCORE_H */
Loading

0 comments on commit dec6f4b

Please sign in to comment.