summaryrefslogtreecommitdiff
path: root/libretro.c
diff options
context:
space:
mode:
authorFrancisco José García García2016-08-08 13:13:22 +0200
committerFrancisco José García García2016-08-08 13:13:22 +0200
commit177abe6a22c1ad95305587256b6c39baf9a25168 (patch)
treed886a4fbd91cfafd5b8a4502742693912189f07e /libretro.c
parentbeeee745ab0961a246f3413f3fbd7d65ad75c4ba (diff)
downloadpicogpsp-177abe6a22c1ad95305587256b6c39baf9a25168.tar.gz
picogpsp-177abe6a22c1ad95305587256b6c39baf9a25168.tar.bz2
picogpsp-177abe6a22c1ad95305587256b6c39baf9a25168.zip
(VITA) Continue WIP - Fix Block for VM alignment
Diffstat (limited to 'libretro.c')
-rw-r--r--libretro.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/libretro.c b/libretro.c
index 0de5075..b0fac00 100644
--- a/libretro.c
+++ b/libretro.c
@@ -12,6 +12,13 @@
#if defined(VITA)
#include <psp2/kernel/sysmem.h>
static int translation_caches_inited = 0;
+static inline int align(int x, int n) {
+ return (((x >> n) + 1) << n );
+}
+
+#define FOUR_KB_ALIGN(x) align(x, 12)
+#define MB_ALIGN(x) align(x, 20)
+
#endif
#if defined(_3DS)
@@ -156,20 +163,26 @@ void retro_init(void)
if(!translation_caches_inited){
void* currentHandle;
- sceBlock = sceKernelAllocMemBlockForVM("code", ROM_TRANSLATION_CACHE_SIZE +
+ sceBlock = sceKernelAllocMemBlockForVM("code", MB_ALIGN(FOUR_KB_ALIGN(ROM_TRANSLATION_CACHE_SIZE +
RAM_TRANSLATION_CACHE_SIZE +
- BIOS_TRANSLATION_CACHE_SIZE);
+ BIOS_TRANSLATION_CACHE_SIZE)));
+ FILE * fd = fopen("ux0:/temp/test.txt","w+");
+ fprintf(fd,"%x\n",sceBlock);
if (sceBlock < 0)
{
- return sceBlock;
+ return;
}
// get base address
int ret = sceKernelGetMemBlockBase(sceBlock, &currentHandle);
if (ret < 0)
{
- return ret;
+ return;
}
+ fprintf(fd,"%x %x\n",currentHandle,ret);
+
+ fclose(fd);
+
rom_translation_cache = (u8*)currentHandle;
ram_translation_cache = rom_translation_cache + ROM_TRANSLATION_CACHE_SIZE;
bios_translation_cache = ram_translation_cache + RAM_TRANSLATION_CACHE_SIZE;