Update to the new, POSIX-Complient PSPSDK

Introduces a lot of changes to induce POSIX compliancy, and fix weird
compilation quirks that the old GCC ignored. Also removes some old
Makefiles that were just lying around. :^)
This commit is contained in:
Steam Deck User 2023-03-27 13:04:29 -04:00
parent e10d0a429e
commit 5a16a272c5
20 changed files with 49 additions and 314 deletions

View file

@ -4,13 +4,12 @@ jobs:
Compile-EBOOTs:
runs-on: ubuntu-latest
container:
image: sharkwouter/pspdev
image: pspdev/pspdev
steps:
- uses: actions/checkout@v2
- name: Get apt ready
- name: Get container ready
run: |
apt update
apt install -y zip
apk add bash zip git gmp mpc1 mpfr4 make
- name: Build
working-directory: ./
run: |

View file

@ -108,11 +108,11 @@ HARDWARE_VIDEO_ONLY_FLAGS = -DPSP_HARDWARE_VIDEO
OBJS = $(COMMON_OBJS) $(HARDWARE_VIDEO_ONLY_OBJS)
SDL_LIBS = -lSDL2 -lvorbisfile -lvorbis -logg -lGL -lGLU -lglut
SDL_LIBS = -lSDL2 -lSDL2main -lvorbisfile -lvorbis -logg -lGL -lGLU -lglut
GU_LIBS = -lpspgum_vfpu -lpspvfpu -lpspgu -lpspvram
AUDIO_LIBS = -lpspaudiolib -lpspaudio -lpspmp3 source/psp/m33libs/libpspaudiocodec.a source/psp/m33libs/libpspkubridge.a
MISC_LIBS = -lpsprtc -lpsppower -lpspmath -lpsphprm -ljpeg -lpng source/psp/m33libs/libz.a
MISC_LIBS = -lpsprtc -lpsppower -lpspmath -lpsphprm -ljpeg -lpng -lz
NET_LIBS = -lpspwlan -lpspnet_adhoc -lpspnet_adhocctl
STD_LIBS = -lstdc++ -lm -lc
LIBS = $(GPROF_LIBS) $(SDL_LIBS) $(GU_LIBS) $(AUDIO_LIBS) $(MISC_LIBS) $(STD_LIBS) $(NET_LIBS)

View file

@ -110,11 +110,11 @@ HARDWARE_VIDEO_ONLY_FLAGS = -DPSP_HARDWARE_VIDEO
OBJS = $(COMMON_OBJS) $(HARDWARE_VIDEO_ONLY_OBJS)
SDL_LIBS = -lSDL2 -lvorbisfile -lvorbis -logg -lGL -lGLU -lglut
SDL_LIBS = -lSDL2 -lSDL2main -lvorbisfile -lvorbis -logg -lGL -lGLU -lglut
GU_LIBS = -lpspgum_vfpu -lpspvfpu -lpspgu -lpspvram
AUDIO_LIBS = -lpspaudiolib -lpspaudio -lpspmp3 source/psp/m33libs/libpspaudiocodec.a source/psp/m33libs/libpspkubridge.a
MISC_LIBS = -lpsprtc -lpsppower -lpspmath -lpsphprm -ljpeg -lpng source/psp/m33libs/libz.a
MISC_LIBS = -lpsprtc -lpsppower -lpspmath -lpsphprm -ljpeg -lpng -lz
NET_LIBS = -lpspwlan -lpspnet_adhoc -lpspnet_adhocctl
STD_LIBS = -lstdc++ -lm -lc
LIBS = $(GPROF_LIBS) $(SDL_LIBS) $(GU_LIBS) $(AUDIO_LIBS) $(MISC_LIBS) $(STD_LIBS) $(NET_LIBS)

View file

@ -4,7 +4,7 @@
This repository contains the PSP engine for NZ:P, based on dQuakePlus and containing optimizations from the NZ:P Team, adQuake, and Xash3D-PSP, as well as NZ:P-specific feature implementation. It has also been modified to build on the latest versions of the [PSPSDK](https://github.com/pspdev/pspsdk).
## Building (Advanced)
Building requires a full install of [psptoolchain](https://github.com/pspdev/psptoolchain/). You can either follow the instructions on the GitHub repository or use a Docker container (we recommend [sharkwouter](https://hub.docker.com/r/sharkwouter/pspdev)'s)!
Building requires a full install of [psptoolchain](https://github.com/pspdev/psptoolchain/). You can either follow the instructions on the GitHub repository or use a Docker container (we recommend [the official one](https://hub.docker.com/r/pspdev/pspdev))!
With the psptoolchain installed, you now need to install `libpspmath`, which we have included in the GitHub repository:
```bash

View file

@ -319,7 +319,7 @@ Send the intended movement message to the server
================
*/
cvar_t waypoint_mode;
extern cvar_t waypoint_mode;
float crosshair_opacity;
void CL_BaseMove (usercmd_t *cmd)
{

View file

@ -1314,7 +1314,7 @@ void CL_ParseServerMessage (void)
cl.cdtrack = MSG_ReadByte ();
cl.looptrack = MSG_ReadByte ();
if (strcmpi(bgmtype.string,"cd") == 0)
if (strcasecmp(bgmtype.string,"cd") == 0)
{
if ( (cls.demoplayback || cls.demorecording) && (cls.forcetrack != -1) )
CDAudio_Play ((byte)cls.forcetrack, true);

View file

@ -31,6 +31,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static int net_landriverlevel;
int net_driver_to_use;
/* statistic counters */
int packetsSent = 0;
int packetsReSent = 0;

View file

@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// net_dgrm.h
int net_driver_to_use;
extern int net_driver_to_use;
int Datagram_Init (void);
void Datagram_Listen (qboolean state);

View file

@ -1,130 +0,0 @@
PSPSDK = $(shell psp-config --pspsdk-path)
PSPLIBSDIR = $(PSPSDK)/..
TARGET = nzportable
PSP_EBOOT_TITLE = Nazi Zombies Portable Reboot
PSP_EBOOT_ICON = pics/icon.png
PSP_EBOOT_SND0 = pics/snd0.at3
PSP_EBOOT_PIC1 = pics/pic.png
PSP_FW_VERSION=660
MODE=-DKERNEL_MODE
BUILD_PRX = 1
COMMON_OBJS = \
battery.o \
../thread.o \
VramExt.o \
input.o \
main.o \
math.o \
sound.o \
system.o \
module.o \
network.o \
network_psp.o \
gethost.o \
fnmatch.o \
cd.o \
mp3.o \
Random.o \
\
../chase.o \
../cl_demo.o \
../cl_input.o \
../cl_main.o \
../cl_parse.o \
../cl_tent.o \
../cl_slist.o \
../cmd.o \
../common.o \
../console.o \
../crc.o \
../cvar.o \
../host.o \
../host_cmd.o \
../keys.o \
../mathlib.o \
../menu.o \
../net_dgrm.o \
../net_loop.o \
../net_main.o \
../net_vcr.o \
../pr_cmds.o \
../pr_edict.o \
../pr_exec.o \
../snd_dma.o \
../snd_mem.o \
../snd_mix.o \
../cl_hud.o \
../sv_main.o \
../sv_move.o \
../sv_phys.o \
../sv_user.o \
../view.o \
../wad.o \
../world.o \
../zone.o \
../crypter.o
HARDWARE_VIDEO_ONLY_OBJS = \
wad3.o \
clipping.o \
vram.o \
video_hardware.o \
video_hardware_resample.o \
video_hardware_images.o \
video_hardware_fullbright.o \
video_hardware_hlmdl.o \
video_hardware_draw.o \
video_hardware_entity_fragment.o \
video_hardware_QMB.o \
video_hardware_decals_QMB.o \
video_hardware_part.o \
video_hardware_light.o \
video_hardware_main.o \
video_hardware_mesh.o \
video_hardware_mhex2.o \
video_hardware_misc.o \
video_hardware_model.o \
video_hardware_screen.o \
video_hardware_surface.o \
video_hardware_warp.o \
video_hardware_fog.o \
video_hardware_dxtn.o
HARDWARE_VIDEO_ONLY_FLAGS = -DPSP_HARDWARE_VIDEO
OBJS = $(COMMON_OBJS) $(HARDWARE_VIDEO_ONLY_OBJS)
#LIBS = -lpspaudiolib -lpspaudio -lpspgum -lpspgu -lpsprtc -lpsppower -lpspwlan -lstdc++ -lm
GU_LIBS = -lpspgum_vfpu -lpspvfpu -lpspgu -lpspvram
AUDIO_LIBS = -lpspaudiolib -lpspaudio -lpspmp3 m33libs/libpspaudiocodec.a m33libs/libpspkubridge.a
MISC_LIBS = -lpsprtc -lpspmath -lpsppower -lpsphprm -ljpeg -lpng m33libs/libz.a iridlibs/libPerf.a
NET_LIBS = -lpspwlan -lpspnet_adhoc -lpspnet_adhocctl
STD_LIBS = -lstdc++ -lm -lc
LIBS = $(GU_LIBS) $(AUDIO_LIBS) $(MISC_LIBS) $(STD_LIBS) $(NET_LIBS)
CFLAGS = -ffast-math -O3 -G0 -Wall -Did386="0" -DPSP $(MODE) $(HARDWARE_VIDEO_ONLY_FLAGS) -DSWIZZLE32 -DPSP_MP3_HWDECODE -DFULLBRIGHT -DHL_RENDER -Wno-strict-aliasing -DPSP_VFPU
CXXFLAGS = -fno-rtti -Wcast-qual -Wno-write-strings -Wno-sign-compare -Wno-strict-aliasing
ASFLAGS = $(CFLAGS) -c
include $(PSPSDK)/lib/build.mak
ifneq ($(VS_PATH),)
CC = vs-psp-gcc
CXX = vs-psp-g++
endif
install: EBOOT.PBP
mv EBOOT.PBP ../../../../psp/nzportable/
@echo DONE

View file

@ -1,132 +0,0 @@
PSPSDK = $(shell psp-config --pspsdk-path)
PSPLIBSDIR = $(PSPSDK)/..
TARGET = nzportable
PSP_EBOOT_TITLE = Nazi Zombies Portable Reboot
PSP_EBOOT_ICON = pics/icon.png
PSP_EBOOT_SND0 = pics/snd0.at3
PSP_EBOOT_PIC1 = pics/pic.png
PSP_FW_VERSION=660
PSP_LARGE_MEMORY = 1
MODE=-DKERNEL_MODE
BUILD_PRX = 1
COMMON_OBJS = \
battery.o \
../thread.o \
VramExt.o \
input.o \
main.o \
math.o \
sound.o \
system.o \
module.o \
network.o \
network_psp.o \
gethost.o \
fnmatch.o \
cd.o \
mp3.o \
Random.o \
\
../chase.o \
../cl_demo.o \
../cl_input.o \
../cl_main.o \
../cl_parse.o \
../cl_tent.o \
../cl_slist.o \
../cmd.o \
../common.o \
../console.o \
../crc.o \
../cvar.o \
../host.o \
../host_cmd.o \
../keys.o \
../mathlib.o \
../menu.o \
../net_dgrm.o \
../net_loop.o \
../net_main.o \
../net_vcr.o \
../pr_cmds.o \
../pr_edict.o \
../pr_exec.o \
../snd_dma.o \
../snd_mem.o \
../snd_mix.o \
../cl_hud.o \
../sv_main.o \
../sv_move.o \
../sv_phys.o \
../sv_user.o \
../view.o \
../wad.o \
../world.o \
../zone.o \
../crypter.o
HARDWARE_VIDEO_ONLY_OBJS = \
wad3.o \
clipping.o \
vram.o \
video_hardware.o \
video_hardware_resample.o \
video_hardware_images.o \
video_hardware_fullbright.o \
video_hardware_hlmdl.o \
video_hardware_draw.o \
video_hardware_entity_fragment.o \
video_hardware_QMB.o \
video_hardware_decals_QMB.o \
video_hardware_part.o \
video_hardware_light.o \
video_hardware_main.o \
video_hardware_mesh.o \
video_hardware_mhex2.o \
video_hardware_misc.o \
video_hardware_model.o \
video_hardware_screen.o \
video_hardware_surface.o \
video_hardware_warp.o \
video_hardware_fog.o \
video_hardware_dxtn.o
HARDWARE_VIDEO_ONLY_FLAGS = -DPSP_HARDWARE_VIDEO
OBJS = $(COMMON_OBJS) $(HARDWARE_VIDEO_ONLY_OBJS)
#LIBS = -lpspaudiolib -lpspaudio -lpspgum -lpspgu -lpsprtc -lpsppower -lpspwlan -lstdc++ -lm
GU_LIBS = -lpspgum_vfpu -lpspvfpu -lpspgu -lpspvram
AUDIO_LIBS = -lpspaudiolib -lpspaudio -lpspmp3 m33libs/libpspaudiocodec.a m33libs/libpspkubridge.a
MISC_LIBS = -lpsprtc -lpsppower -lpspmath -lpsphprm -ljpeg -lpng m33libs/libz.a iridlibs/libPerf.a
NET_LIBS = -lpspwlan -lpspnet_adhoc -lpspnet_adhocctl
STD_LIBS = -lstdc++ -lm -lc
LIBS = $(GU_LIBS) $(AUDIO_LIBS) $(MISC_LIBS) $(STD_LIBS) $(NET_LIBS)
CFLAGS = -ffast-math -O3 -G0 -Wall -Did386="0" -DPSP $(MODE) $(HARDWARE_VIDEO_ONLY_FLAGS) -DSWIZZLE32 -DSLIM -DPSP_MP3_HWDECODE -DFULLBRIGHT -DHL_RENDER -Wno-strict-aliasing -DPSP_VFPU
CXXFLAGS = -fno-rtti -Wcast-qual -Wno-write-strings -Wno-sign-compare -Wno-strict-aliasing
ASFLAGS = $(CFLAGS) -c
include $(PSPSDK)/lib/build.mak
ifneq ($(VS_PATH),)
CC = vs-psp-gcc
CXX = vs-psp-g++
endif
install: EBOOT.PBP
mv EBOOT.PBP ../../../../psp/nzportable/EBOOT2000.PBP
@echo DONE

View file

@ -270,7 +270,7 @@ void CDAudio_Update(void)
// CDAudio_VolumeChange(bgmvolume.value);
//if(changeMp3Volume) CDAudio_VolumeChange(bgmvolume.value);
if (strcmpi(bgmtype.string,"cd") == 0) {
if (strcasecmp(bgmtype.string,"cd") == 0) {
/*if(mp3_status == MP3_END)
{
if(cd_loop == 1) {

View file

@ -72,15 +72,15 @@ void Sys_ReadCommandLineFile (char* netpath);
#define MIN_HEAP_MB 6
#define MAX_HEAP_MB (PSP_HEAP_SIZE_MB-1)
// Clock speeds.
int cpuClockSpeed;
int ramClockSpeed;
int busClockSpeed;
namespace quake
{
namespace main
{
// Clock speeds.
extern const int cpuClockSpeed = scePowerGetCpuClockFrequencyInt();
extern const int ramClockSpeed = cpuClockSpeed;
extern const int busClockSpeed = scePowerGetBusClockFrequencyInt();
#ifdef SLIM
@ -238,8 +238,8 @@ void StartUpParams(char **args, int argc, char *cmdlinePath, char *currentDirect
do {
res = sceIoDread(dir_fd, p_dir_de);
if ((res > 0) && (p_dir_de->d_stat.st_attr & FIO_SO_IFDIR)) {
if (!(stricmp(p_dir_de->d_name, ".") == 0 || stricmp(p_dir_de->d_name, "..") == 0 ||
stricmp(p_dir_de->d_name, "mp3") == 0 || stricmp(p_dir_de->d_name, "id1") == 0)) {
if (!(strcasecmp(p_dir_de->d_name, ".") == 0 || strcasecmp(p_dir_de->d_name, "..") == 0 ||
strcasecmp(p_dir_de->d_name, "mp3") == 0 || strcasecmp(p_dir_de->d_name, "id1") == 0)) {
dirs[j++] = strdup( p_dir_de->d_name);
}
}
@ -259,7 +259,7 @@ void StartUpParams(char **args, int argc, char *cmdlinePath, char *currentDirect
if (idx+1 < f_argc) {
for (int i = 0 ;i < MAX_HEAP_MB - MIN_HEAP_MB; i++) {
if (stricmp(heaps[i], args[idx+1]) == 0) {
if (strcasecmp(heaps[i], args[idx+1]) == 0) {
menu_cur[2] = i;
}
@ -271,7 +271,7 @@ void StartUpParams(char **args, int argc, char *cmdlinePath, char *currentDirect
} else {
for (int i = 0 ;i < MAX_HEAP_MB - MIN_HEAP_MB; i++) {
sprintf(temp_str, "%d", heapSize/(1024*1024));
if (stricmp(heaps[i],temp_str) == 0) {
if (strcasecmp(heaps[i],temp_str) == 0) {
menu_cur[2] = i;
}
}
@ -282,7 +282,7 @@ void StartUpParams(char **args, int argc, char *cmdlinePath, char *currentDirect
if (idx+1 < f_argc) {
for (int i = 0 ;i < j; i++) {
if (stricmp(args[idx+1],dirs[i]) == 0) {
if (strcasecmp(args[idx+1],dirs[i]) == 0) {
menu_cur[0] = i;
}
@ -363,7 +363,7 @@ void StartUpParams(char **args, int argc, char *cmdlinePath, char *currentDirect
}
}
if(sceHprmIsRemoteExist()){
unsigned int hprmkey;
u32 hprmkey;
sceHprmPeekCurrentKey(&hprmkey);
if (hprmkey != 0){
if (hprmkey & PSP_HPRM_BACK){
@ -383,7 +383,7 @@ void StartUpParams(char **args, int argc, char *cmdlinePath, char *currentDirect
}
if (CheckParm(args, f_argc, "-game")) {
int idx = CheckParm(args, f_argc, "-game");
if (stricmp(args[idx+1],dirs[menu_cur[0]]) != 0) {
if (strcasecmp(args[idx+1],dirs[menu_cur[0]]) != 0) {
if (strlen(dirs[menu_cur[0]]) > 0) {
int len2 = strlen(dirs[menu_cur[0]]);
@ -410,7 +410,7 @@ void StartUpParams(char **args, int argc, char *cmdlinePath, char *currentDirect
}
}
if (stricmp(cpus[menu_cur[1]],"333") == 0) {
if (strcasecmp(cpus[menu_cur[1]],"333") == 0) {
if (!CheckParm(args, f_argc, "-cpu333")) {
int len1 = strlen("-cpu333");
@ -541,6 +541,9 @@ int user_main(SceSize argc, void* argp)
return 0;
}
ramClockSpeed = cpuClockSpeed = scePowerGetCpuClockFrequencyInt();
busClockSpeed = scePowerGetBusClockFrequencyInt();
// Get the current working dir.
char currentDirectory[1024];
char gameDirectory[1024];

View file

@ -23,6 +23,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "module.h"
// Set up the module info.
PSP_MODULE_INFO("NZPortable", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER | PSP_THREAD_ATTR_VFPU);
PSP_HEAP_SIZE_KB(-1024);

View file

@ -6,4 +6,4 @@ extern "C" int mp3_start_play(char *fname, int pos);
extern "C" int mp3_job_started;
int mp3_volume;
extern int mp3_volume;

View file

@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <psputility.h>
#include <pspnet.h>
#include <pspwlan.h>
#include <pspnet_inet.h>
#include <pspnet_apctl.h>
#include <pspnet_adhoc.h>
#include <pspnet_adhocctl.h>
@ -755,7 +756,7 @@ namespace quake
pdpStatStruct *tempPdp = findPdpStat(accept_socket, pdpStat);
if(tempPdp < 0) return -1;
if(tempPdp->pdpId < 0) return -1;
if(tempPdp->rcvdData > 0) return accept_socket;
@ -861,7 +862,7 @@ namespace quake
if(err<0) return -1;
pdpStatStruct *tempPdp = findPdpStat(socket, pdpStat);
if(tempPdp < 0) return -1;
if(tempPdp->pdpId < 0) return -1;
memcpy_vfpu(((struct sockaddr_adhoc *)addr)->mac, tempPdp->mac, 6);
((struct sockaddr_adhoc *)addr)->port = tempPdp->port;

View file

@ -55,17 +55,14 @@ extern "C"
}
#include "fnmatch.h"
extern int cpuClockSpeed;
extern int ramClockSpeed;
extern int busClockSpeed;
void CDAudio_Stop(void);
namespace quake
{
namespace main
{
extern const int cpuClockSpeed;
extern const int ramClockSpeed;
extern const int busClockSpeed;
}
namespace system
{
struct file
@ -410,7 +407,7 @@ void Sys_Quit (void)
}
// Restore the old clock frequency.
scePowerSetClockFrequency(main::cpuClockSpeed, main::ramClockSpeed, main::busClockSpeed);
scePowerSetClockFrequency(cpuClockSpeed, ramClockSpeed, busClockSpeed);
// Insert a false delay so files and stuff can be saved before the kernel kills us.
sceKernelDelayThread(50 * 1000);

View file

@ -171,19 +171,19 @@ void VID_Init(unsigned char* palette)
Sys_Printf("VID_Init\n");
// Allocate the buffers.
display_buffer = static_cast<pixel*>(valloc(screen_height * 512 * sizeof(pixel)));
display_buffer = static_cast<pixel*>(vramalloc(screen_height * 512 * sizeof(pixel)));
if (!display_buffer)
{
Sys_Error("Couldn't allocate display buffer");
}
draw_buffer = static_cast<pixel*>(valloc(screen_height * 512 * sizeof(pixel)));
draw_buffer = static_cast<pixel*>(vramalloc(screen_height * 512 * sizeof(pixel)));
if (!draw_buffer)
{
Sys_Error("Couldn't allocate draw buffer");
}
depth_buffer = static_cast<depth_value*>(valloc(screen_height * 512 * sizeof(depth_value)));
depth_buffer = static_cast<depth_value*>(vramalloc(screen_height * 512 * sizeof(depth_value)));
if (!depth_buffer)
{
Sys_Error("Couldn't allocate depth buffer");

View file

@ -30,8 +30,8 @@ extern"C"
#include <pspgu.h>
#include <pspgum.h>
#include <list>
using namespace std;
extern list<int> mapTextureNameList;
extern std::list<int> mapTextureNameList;
extern model_t *loadmodel;

View file

@ -36,9 +36,8 @@ extern "C"
#include "video_hardware_hlmdl.h"
#include <list>
using namespace std;
list<int> mapTextureNameList;
std::list<int> mapTextureNameList;
int LIGHTMAP_BYTES;
@ -3322,10 +3321,10 @@ void Mod_LoadQ3AliasModel (model_t *mod, void *buffer)
{
for (j=0 ; j<3 ; j++)
{
md3bboxmins[j] = min(md3bboxmins[j], frame[i].mins[j]);
md3bboxmaxs[j] = max(md3bboxmaxs[j], frame[i].maxs[j]);
md3bboxmins[j] = std::min(md3bboxmins[j], frame[i].mins[j]);
md3bboxmaxs[j] = std::max(md3bboxmaxs[j], frame[i].maxs[j]);
}
radiusmax = max(radiusmax, frame[i].radius);
radiusmax = std::max(radiusmax, frame[i].radius);
}
VectorCopy (md3bboxmins, mod->mins);
VectorCopy (md3bboxmaxs, mod->maxs);

View file

@ -28,9 +28,7 @@ extern "C"
#include <list>
using namespace std;
list<FILE*> UnloadFileList;
std::list<FILE*> UnloadFileList;
#define TEXWAD_MAXIMAGES 16384
typedef struct