fgsfds
2 years ago
committed by
Alibek Omarov
33 changed files with 533 additions and 28 deletions
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
net.h - psvita network stubs |
||||
Copyright (C) 2021-2023 fgsfds |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
*/ |
||||
|
||||
#pragma once |
||||
#ifndef NET_PSVITA_H |
||||
#define NET_PSVITA_H |
||||
|
||||
#include <vitasdk.h> |
||||
|
||||
/* we're missing IPv6 support; define some trash */ |
||||
|
||||
#ifndef IN6_IS_ADDR_V4MAPPED |
||||
#define IN6_IS_ADDR_V4MAPPED( p ) ( 0 ) |
||||
#endif |
||||
|
||||
#ifndef IPPROTO_IPV6 |
||||
#define IPPROTO_IPV6 41 |
||||
#endif |
||||
|
||||
#ifndef IPV6_MULTICAST_LOOP |
||||
#define IPV6_MULTICAST_LOOP 19 |
||||
#endif |
||||
|
||||
#ifndef IPV6_V6ONLY |
||||
#define IPV6_V6ONLY 26 |
||||
#endif |
||||
|
||||
#ifndef FIONBIO |
||||
#define FIONBIO SO_NONBLOCK |
||||
#endif |
||||
|
||||
// this is only used to set non-blocking on sockets
|
||||
static inline int ioctlsocket( int fd, int req, unsigned int *arg ) |
||||
{ |
||||
return setsockopt( fd, SOL_SOCKET, SO_NONBLOCK, arg, sizeof( *arg ) ); |
||||
} |
||||
|
||||
#endif // NET_PSVITA_H
|
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 306 KiB |
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
|
||||
<livearea style="psmobile" format-ver="01.03" content-rev="1"> |
||||
<livearea-background> |
||||
<image>bg.png</image> |
||||
</livearea-background> |
||||
|
||||
<gate> |
||||
<startup-image>startup.png</startup-image> |
||||
</gate> |
||||
</livearea> |
@ -0,0 +1,117 @@
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
sys_psvita.c - psvita backend |
||||
Copyright (C) 2021-2023 fgsfds |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
*/ |
||||
|
||||
#include "platform/platform.h" |
||||
#include <stdlib.h> |
||||
#include <stdio.h> |
||||
#include <string.h> |
||||
#include <time.h> |
||||
#include <ctype.h> |
||||
#include <vitasdk.h> |
||||
#include <vrtld.h> |
||||
|
||||
#define DATA_PATH "data/xash3d" |
||||
|
||||
/* HACKHACK: force-export stuff required by the dynamic libs */ |
||||
|
||||
extern void *__aeabi_idiv; |
||||
extern void *__aeabi_uidiv; |
||||
extern void *__aeabi_idivmod; |
||||
extern void *__aeabi_d2ulz; |
||||
extern void *__aeabi_ul2d; |
||||
|
||||
static const vrtld_export_t aux_exports[] = |
||||
{ |
||||
VRTLD_EXPORT_SYMBOL( __aeabi_d2ulz ), |
||||
VRTLD_EXPORT_SYMBOL( __aeabi_idiv ), |
||||
VRTLD_EXPORT_SYMBOL( __aeabi_idivmod ), |
||||
VRTLD_EXPORT_SYMBOL( __aeabi_uidiv ), |
||||
VRTLD_EXPORT_SYMBOL( __aeabi_ul2d ), |
||||
VRTLD_EXPORT_SYMBOL( ctime ), |
||||
VRTLD_EXPORT_SYMBOL( vasprintf ), |
||||
VRTLD_EXPORT_SYMBOL( vprintf ), |
||||
VRTLD_EXPORT_SYMBOL( printf ), |
||||
VRTLD_EXPORT_SYMBOL( putchar ), |
||||
VRTLD_EXPORT_SYMBOL( puts ), |
||||
VRTLD_EXPORT_SYMBOL( tolower ), |
||||
VRTLD_EXPORT_SYMBOL( toupper ), |
||||
VRTLD_EXPORT_SYMBOL( strchrnul ), |
||||
VRTLD_EXPORT_SYMBOL( rand ), |
||||
VRTLD_EXPORT_SYMBOL( srand ), |
||||
}; |
||||
|
||||
const vrtld_export_t *__vrtld_exports = aux_exports; |
||||
const size_t __vrtld_num_exports = sizeof( aux_exports ) / sizeof( *aux_exports ); |
||||
|
||||
/* end of export crap */ |
||||
|
||||
SceUInt32 sceUserMainThreadStackSize = 1 * 1024 * 1024; |
||||
unsigned int _newlib_heap_size_user = 128 * 1024 * 1024; |
||||
|
||||
void Platform_ShellExecute( const char *path, const char *parms ) |
||||
{ |
||||
Con_Reportf( S_WARN "Tried to shell execute ;%s; -- not supported\n", path ); |
||||
} |
||||
|
||||
void PSVita_Init( void ) |
||||
{ |
||||
char xashdir[1024] = { 0 }; |
||||
|
||||
// cd to the base dir immediately for library loading to work
|
||||
if ( PSVita_GetBasePath( xashdir, sizeof( xashdir ) ) ) |
||||
{ |
||||
chdir( xashdir ); |
||||
} |
||||
|
||||
sceCtrlSetSamplingModeExt( SCE_CTRL_MODE_ANALOG_WIDE ); |
||||
sceTouchSetSamplingState( SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START ); |
||||
scePowerSetArmClockFrequency( 444 ); |
||||
scePowerSetBusClockFrequency( 222 ); |
||||
scePowerSetGpuClockFrequency( 222 ); |
||||
scePowerSetGpuXbarClockFrequency( 166 ); |
||||
sceSysmoduleLoadModule( SCE_SYSMODULE_NET ); |
||||
|
||||
if ( vrtld_init( 0 ) < 0 ) |
||||
{ |
||||
Sys_Error( "Could not init vrtld: %s\n", vrtld_dlerror( ) ); |
||||
} |
||||
} |
||||
|
||||
void PSVita_Shutdown( void ) |
||||
{ |
||||
vrtld_quit( ); |
||||
} |
||||
|
||||
qboolean PSVita_GetBasePath( char *buf, const size_t buflen ) |
||||
{ |
||||
// check if a xash3d folder exists on one of these drives
|
||||
// default to the last one (ux0)
|
||||
static const char *drives[] = { "uma0", "imc0", "ux0" }; |
||||
SceUID dir; |
||||
size_t i; |
||||
|
||||
for ( i = 0; i < sizeof( drives ) / sizeof( *drives ); ++i ) |
||||
{ |
||||
Q_snprintf( buf, buflen, "%s:" DATA_PATH, drives[i] ); |
||||
dir = sceIoDopen( buf ); |
||||
if ( dir >= 0 ) |
||||
{ |
||||
sceIoDclose( dir ); |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
return false; |
||||
} |
@ -0,0 +1,110 @@
@@ -0,0 +1,110 @@
|
||||
# encoding: utf-8 |
||||
# psvita.py -- PSVita VPK task |
||||
# Copyright (C) 2023 fgsfds |
||||
# This program is free software: you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation, either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
|
||||
from waflib.Tools import ccroot |
||||
from waflib import * |
||||
|
||||
def add_source_file(ctx, nodes, f): |
||||
if f: |
||||
if isinstance(f, str): |
||||
node = ctx.path.make_node(f) |
||||
elif isinstance(f, Node.Node): |
||||
node = f |
||||
nodes += [node] |
||||
return node |
||||
return None |
||||
|
||||
def configure(conf): |
||||
conf.find_program('vita-elf-create', var='ELF_CREATE') |
||||
conf.find_program('vita-make-fself', var='MAKE_FSELF') |
||||
conf.find_program('vita-mksfoex', var='MKSFOEX') |
||||
conf.find_program('vita-pack-vpk', var='PACKVPK') |
||||
|
||||
class mkvelf(Task.Task): |
||||
color = 'CYAN' |
||||
run_str = '${ELF_CREATE} -g ${YMLFILE} ${ELFFILE} ${TGT}' |
||||
|
||||
class mkfself(Task.Task): |
||||
color = 'CYAN' |
||||
run_str = '${MAKE_FSELF} ${VELFFILE} ${TGT}' |
||||
|
||||
class mksfoex(Task.Task): |
||||
color = 'CYAN' |
||||
# ATTRIBUTE2=12 enables the biggest extended memory mode |
||||
run_str = '${MKSFOEX} -s TITLE_ID=${TITLEID} -d ATTRIBUTE2=12 ${APPNAME} ${TGT}' |
||||
|
||||
class mkvpk(Task.Task): |
||||
color = 'CYAN' |
||||
run_str = '${PACKVPK} -s ${SFOFILE} -b ${FSELFFILE} -a ${SCESYS}=sce_sys ${TGT}' |
||||
|
||||
@TaskGen.feature('cxxprogram') |
||||
@TaskGen.after_method('apply_link') |
||||
def apply_velf(self): |
||||
elffile = self.link_task.outputs[0] |
||||
in_nodes = [elffile] |
||||
|
||||
ymlfile = elffile.change_ext('.yml') |
||||
velffile = elffile.change_ext('.velf') |
||||
out_nodes = [velffile, ymlfile] |
||||
|
||||
self.env.ELFFILE = str(elffile) |
||||
self.env.VELFFILE = str(velffile) |
||||
self.env.YMLFILE = str(ymlfile) |
||||
|
||||
self.velf_task = self.create_task('mkvelf', in_nodes) |
||||
self.velf_task.set_outputs(out_nodes) |
||||
|
||||
@TaskGen.feature('cxxprogram') |
||||
@TaskGen.after_method('apply_velf') |
||||
def apply_fself(self): |
||||
velffile = self.velf_task.outputs[0] |
||||
in_nodes = [velffile] |
||||
|
||||
fselffile = velffile.change_ext('.bin') |
||||
out_nodes = [fselffile] |
||||
|
||||
self.env.FSELFFILE = str(fselffile) |
||||
|
||||
self.fself_task = self.create_task('mkfself', in_nodes) |
||||
self.fself_task.set_outputs(out_nodes) |
||||
|
||||
@TaskGen.feature('cxxprogram') |
||||
@TaskGen.after_method('apply_fself') |
||||
def apply_sfo(self): |
||||
fselffile = self.fself_task.outputs[0] |
||||
in_nodes = [fselffile] |
||||
|
||||
sfofile = fselffile.change_ext('.sfo') |
||||
out_nodes = [sfofile] |
||||
|
||||
self.env.SFOFILE = str(sfofile) |
||||
|
||||
self.sfo_task = self.create_task('mksfoex', in_nodes) |
||||
self.sfo_task.set_outputs(out_nodes) |
||||
|
||||
@TaskGen.feature('cxxprogram') |
||||
@TaskGen.after_method('apply_sfo') |
||||
def apply_vpk(self): |
||||
fselffile = self.fself_task.outputs[0] |
||||
sfofile = self.sfo_task.outputs[0] |
||||
in_nodes = [fselffile, sfofile] |
||||
scesysdir = add_source_file(self, in_nodes, getattr(self, 'sce_sys', None)) |
||||
|
||||
vpkfile = sfofile.change_ext('.vpk') |
||||
out_nodes = [vpkfile] |
||||
|
||||
if scesysdir: self.env.SCESYS = str(scesysdir) |
||||
self.env.VPKFILE = str(vpkfile) |
||||
|
||||
self.vpk_task = self.create_task('mkvpk', in_nodes) |
||||
self.vpk_task.set_outputs(out_nodes) |
Loading…
Reference in new issue