Last active
April 17, 2026 16:54
-
-
Save Kethen/c3c14e753b029043222bb3b067fc40db to your computer and use it in GitHub Desktop.
vita_vram_probe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <pspkernel.h> | |
| #include <pspiofilemgr.h> | |
| #include <pspge.h> | |
| #include <stdio.h> | |
| #include <string.h> | |
| PSP_MODULE_INFO("bram test", 0, 1, 0); | |
| PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER); | |
| PSP_MAIN_THREAD_STACK_SIZE_KB(8192); | |
| PSP_HEAP_SIZE_KB(0); | |
| #define LOG_PATH "ms0:/vram_test.log" | |
| #define LOG(...) { \ | |
| int _fd = sceIoOpen(LOG_PATH, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_APPEND, 0777); \ | |
| if (_fd > 0){ \ | |
| char _log_buf[2048] = {0}; \ | |
| int _len = sprintf(_log_buf, __VA_ARGS__); \ | |
| sceIoWrite(_fd, _log_buf, _len); \ | |
| sceIoClose(_fd); \ | |
| } \ | |
| } | |
| static void init_logging(){ | |
| int fd = sceIoOpen(LOG_PATH, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777); | |
| if (fd > 0){ | |
| sceIoClose(fd); | |
| } | |
| } | |
| static int read_mem(const void *src, int len){ | |
| for(int i = 0;i < len;i++){ | |
| u32 val = *(u8*)&src[i]; | |
| LOG("0x%02x ", val); | |
| } | |
| LOG("\n"); | |
| } | |
| static void test_write(void *dst, void * buf, int len){ | |
| LOG("pre-write of 0x%x:\n", dst); | |
| read_mem(dst, len); | |
| memcpy(dst, buf, len); | |
| LOG("post-write of 0x%x:\n", dst); | |
| read_mem(dst, len); | |
| } | |
| int main(int argc, char *argv[]) | |
| { | |
| init_logging(); | |
| LOG("vram test\n"); | |
| LOG("%s: sceGeEdramGetAddr returns 0x%08x\n\n", __func__, sceGeEdramGetAddr()); | |
| for (int i = 0;i < 2;i++){ | |
| u8 test_array[] = {0 + i, 1 + i, 2 + i, 3 + i, 4 + i, 5 + i, 6 + i, 7 + i, 8 + i}; | |
| test_write((void *)0x44000000, test_array, sizeof(test_array)); | |
| test_write((void *)0x44100000, test_array, sizeof(test_array)); | |
| test_write((void *)0x44200000, test_array, sizeof(test_array)); | |
| test_write((void *)0x44300000, test_array, sizeof(test_array)); | |
| LOG("\n"); | |
| } | |
| sceKernelExitGame(); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment