7 changed files with 84 additions and 1 deletions
@ -1,5 +1,5 @@
|
||||
set(ASAN OFF) |
||||
set(UBSAN OFF) |
||||
set(NONET ON) |
||||
set(DISABLE_ZERO_TIER ON) |
||||
set(PREFILL_PLAYER_NAME ON) |
||||
add_definitions("-DMO_LANG_DIR=\"app0:/\"") |
||||
|
||||
@ -0,0 +1,32 @@
|
||||
#include <cstdlib> |
||||
#include <cstdio> |
||||
#include <unistd.h> |
||||
#include "platform/vita/network.h" |
||||
#include <psp2/sysmodule.h> |
||||
#include <psp2/net/net.h> |
||||
#include <psp2/net/netctl.h> |
||||
|
||||
void vita_enable_network() |
||||
{ |
||||
SceNetInitParam param; |
||||
static char memory[64 * 1024]; |
||||
int ret; |
||||
|
||||
ret = sceSysmoduleLoadModule(SCE_SYSMODULE_NET); |
||||
if (ret < 0) { |
||||
return; |
||||
} |
||||
|
||||
param.memory = memory; |
||||
param.size = sizeof(memory); |
||||
param.flags = 0; |
||||
ret = sceNetInit(¶m); |
||||
if (ret < 0) { |
||||
return; |
||||
} |
||||
|
||||
ret = sceNetCtlInit(); |
||||
if (ret < 0) { |
||||
return; |
||||
} |
||||
} |
||||
@ -0,0 +1,3 @@
|
||||
#pragma once |
||||
|
||||
void vita_enable_network(); |
||||
@ -0,0 +1,34 @@
|
||||
#include <sys/types.h> |
||||
#include <sodium.h> |
||||
#include <psp2/kernel/rng.h> |
||||
|
||||
static const char *randombytes_vitarandom_implementation_name() |
||||
{ |
||||
return "vitarandom"; |
||||
} |
||||
|
||||
static uint32_t randombytes_vitarandom() |
||||
{ |
||||
uint32_t num; |
||||
sceKernelGetRandomNumber(&num, sizeof(uint32_t)); |
||||
return num; |
||||
} |
||||
|
||||
static void randombytes_vitarandom_buf(void *const buf, const size_t size) |
||||
{ |
||||
sceKernelGetRandomNumber(buf, size); |
||||
} |
||||
|
||||
struct randombytes_implementation randombytes_vitarandom_implementation = { |
||||
randombytes_vitarandom_implementation_name, |
||||
randombytes_vitarandom, |
||||
nullptr, |
||||
nullptr, |
||||
randombytes_vitarandom_buf, |
||||
nullptr |
||||
}; |
||||
|
||||
void randombytes_vitarandom_init() |
||||
{ |
||||
randombytes_set_implementation(&randombytes_vitarandom_implementation); |
||||
} |
||||
Loading…
Reference in new issue