Advertising (This ad goes away for registered users. You can Login or Register)

[Release] VITAident - Identity tool for PS Vita

HENkaku is a native Homebrew Enabler for the PS Vita and PS TV. It lets you run homebrews on the PS Vita
eleriaqueen
Posts: 26
Joined: Wed Nov 05, 2014 3:33 pm

Re: VITAident - Identity tool for PS Vita

Post by eleriaqueen »

Aww, looks like you gotta write quite a lot more to be able to print text to the screen then >_< (like this from vita sdk)

Code: Select all

#include "graphics.h"

#include <stdio.h>
#include <string.h>
#include <stdarg.h>

#define SCE_DISPLAY_UPDATETIMING_NEXTVSYNC SCE_DISPLAY_SETBUF_NEXTFRAME
#include <psp2/display.h>
#include <psp2/kernel/sysmem.h>
#include <psp2/kernel/threadmgr.h>

enum {
	SCREEN_WIDTH = 960,
	SCREEN_HEIGHT = 544,
	LINE_SIZE = 960,
	FRAMEBUFFER_SIZE = 2 * 1024 * 1024,
	FRAMEBUFFER_ALIGNMENT = 256 * 1024
};

typedef union
{
	int rgba;
	struct
	{
		char r;
		char g;
		char b;
		char a;
	} c;
} color_t;

extern u8 msx[];
void* g_vram_base;
static int gX = 0;
static int gY = 0;

static Color g_fg_color;
static Color g_bg_color;

static Color* getVramDisplayBuffer()
{
	Color* vram = (Color*) g_vram_base;
	return vram;
}

 // #define LOG(args...)  		vita_logf (__FILE__, __LINE__, args)  ///< Write a log entry

int g_log_mutex;

void psvDebugScreenInit() {
	g_log_mutex = sceKernelCreateMutex("log_mutex", 0, 0, NULL);

	SceKernelAllocMemBlockOpt opt = { 0 };
	#ifdef VITASDK
	opt.size = 4 * 5;
	#else
	opt.size = sizeof(opt);
	#endif
	opt.attr = 0x00000004;
	opt.alignment = FRAMEBUFFER_ALIGNMENT;
	SceUID displayblock = sceKernelAllocMemBlock("display", SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW, FRAMEBUFFER_SIZE, &opt);
	printf("displayblock: 0x%08x", displayblock);
	void *base;
	sceKernelGetMemBlockBase(displayblock, &base);
	// LOG("base: 0x%08x", base);

	SceDisplayFrameBuf framebuf = { 0 };
	framebuf.size = sizeof(framebuf);
	framebuf.base = base;
	framebuf.pitch = SCREEN_WIDTH;
	framebuf.pixelformat = SCE_DISPLAY_PIXELFORMAT_A8B8G8R8;
	framebuf.width = SCREEN_WIDTH;
	framebuf.height = SCREEN_HEIGHT;

	g_vram_base = base;

	int ret = sceDisplaySetFrameBuf(&framebuf, SCE_DISPLAY_UPDATETIMING_NEXTVSYNC);

	g_fg_color = 0xFFFFFFFF;
	g_bg_color = 0x00000000;
}

void psvDebugScreenClear(int bg_color)
{
	gX = gY = 0;
	int i;
	color_t *pixel = (color_t *)getVramDisplayBuffer();
	for(i = 0; i < SCREEN_WIDTH * SCREEN_HEIGHT; i++) {
		pixel->rgba = bg_color;
		pixel++;
	}
}

static void printTextScreen(const char * text)
{
	int c, i, j, l;
	u8 *font;
	Color *vram_ptr;
	Color *vram;

	for (c = 0; c < strlen(text); c++) {
		if (gX + 8 > SCREEN_WIDTH) {
			gY += 8;
			gX = 0;
		}
		if (gY + 8 > SCREEN_HEIGHT) {
			gY = 0;
			psvDebugScreenClear(g_bg_color);
		}
		char ch = text[c];
		if (ch == '\n') {
			gX = 0;
			gY += 8;
			continue;
		} else if (ch == '\r') {
			gX = 0;
			continue;
		}

		vram = getVramDisplayBuffer() + gX + gY * LINE_SIZE;

		font = &msx[ (int)ch * 8];
		for (i = l = 0; i < 8; i++, l += 8, font++) {
			vram_ptr  = vram;
			for (j = 0; j < 8; j++) {
				if ((*font & (128 >> j))) *vram_ptr = g_fg_color;
				else *vram_ptr = g_bg_color;
				vram_ptr++;
			}
			vram += LINE_SIZE;
		}
		gX += 8;
	}
}

void psvDebugScreenPrintf(const char *format, ...) {
	char buf[512];

	sceKernelLockMutex(g_log_mutex, 1, NULL);

	va_list opt;
	va_start(opt, format);
	vsnprintf(buf, sizeof(buf), format, opt);
	printTextScreen(buf);
	va_end(opt);

	sceKernelUnlockMutex(g_log_mutex, 1);
}

Color psvDebugScreenSetFgColor(Color color) {
	Color prev_color = g_fg_color;
	g_fg_color = color;
	return prev_color;
}

Color psvDebugScreenSetBgColor(Color color) {
	Color prev_color = g_bg_color;
	g_bg_color = color;
	return prev_color;
}

Some of it looks complicated :s
Advertising
Joel16
Posts: 914
Joined: Wed Oct 12, 2011 8:47 pm

Re: VITAident - Identity tool for PS Vita

Post by Joel16 »

Not complicated at all, I just totally forgot to initialize the debug screen. For some reason I thought it was automated because the hello world in vitasdk/samples didn't initialize the debug screen. So I assumed there wasn't anything to initialize the console. However when I noticed the http sample used it, I knew just what I was missing.

Here's a new build. Should work now (hopefully)

https://drive.google.com/open?id=0BzIzE ... Hg3TXJOVDg

And thanks John doe, fixed getMacAddress().
Advertising
"Forever in darkness, a guardian devil."
pspuser911
Posts: 60
Joined: Tue Dec 11, 2012 10:42 am
Location: Germany

Re: VITAident - Identity tool for PS Vita

Post by pspuser911 »

hello first thx for your work i have this tool on my psp and my N3DSX. I have tested your new build and it does not function it opens and then it give the error C2-12828-1 (Saved Core File Succeeded ux0:data/psp2core -........-eboot.bin
PS4 (Black)- OFW 3.55
PS3 (CECHK04)- Habib Cobra 4.70
PS VITA (PCH2004)- 3.60-Henkaku-4
PSTV (VTE1016)- 3.36-TN-V
PSP SLIM (FINAL FANTASY SPECIAL EDITION)- 6.61 ME-2.3
Joel16
Posts: 914
Joined: Wed Oct 12, 2011 8:47 pm

Re: VITAident - Identity tool for PS Vita

Post by Joel16 »

I guess I'll have to discontinue this project because someone decided they were gonna make an identity tool instead. They claimed they started this as soon as henkaku was released, but I can't comment on that because their source code isn't up like mine. It's funny how I started this on the 6th of August, and already has tonnes of views so I thought word would go around. I guess not. Well my source code will still be up, and I might still push commits for my own personal use.
"Forever in darkness, a guardian devil."
CelesteBlue
Posts: 50
Joined: Fri Aug 05, 2016 9:19 pm

Re: VITAident - Identity tool for PS Vita

Post by CelesteBlue »

eleriaqueen wrote:Thanks, downloaded the vpk.

Installing...

"Failed to install the package 0x8010113d"

:(

I tried several times, and also tried to re-transfer the file through ftp. (With molecular shell (vita shell 0.6), PSVita Fat)
Of course, you need vita shell 0.7. Otherwise latest HENkaku includes vita shell 0.7...
CelesteBlue
Posts: 50
Joined: Fri Aug 05, 2016 9:19 pm

Re: VITAident - Identity tool for PS Vita

Post by CelesteBlue »

sauske_firekid wrote:I guess I'll have to discontinue this project because someone decided they were gonna make an identity tool instead. They claimed they started this as soon as henkaku was released, but I can't comment on that because their source code isn't up like mine. It's funny how I started this on the 6th of August, and already has tonnes of views so I thought word would go around. I guess not. Well my source code will still be up, and I might still push commits for my own personal use.
Don't worry, Freakler is a famous vita dev...
His project can be found here : https://mobile.twitter.com/freakler94/s ... 9779973121
You can always add missing features, or give him some ideas to make a more complete tool !
Joel16
Posts: 914
Joined: Wed Oct 12, 2011 8:47 pm

Re: VITAident - Identity tool for PS Vita

Post by Joel16 »

CelesteBlue wrote:
sauske_firekid wrote:I guess I'll have to discontinue this project because someone decided they were gonna make an identity tool instead. They claimed they started this as soon as henkaku was released, but I can't comment on that because their source code isn't up like mine. It's funny how I started this on the 6th of August, and already has tonnes of views so I thought word would go around. I guess not. Well my source code will still be up, and I might still push commits for my own personal use.
Don't worry, Freakler is a famous vita dev...
His project can be found here : https://mobile.twitter.com/freakler94/s ... 9779973121
You can always add missing features, or give him some ideas to make a more complete tool !
His source code isn't open. I'd rather update mine personally. I don't go along well with groups. If he had a github or something I wouldn't mind contributing though.
"Forever in darkness, a guardian devil."
NoOne
Posts: 281
Joined: Wed Dec 19, 2012 3:03 pm

Re: VITAident - Identity tool for PS Vita

Post by NoOne »

If you open freakler's vitaidentity, you will notice that the text is so small to read. Maybe you can add custom font?
CelesteBlue
Posts: 50
Joined: Fri Aug 05, 2016 9:19 pm

Re: VITAident - Identity tool for PS Vita

Post by CelesteBlue »

sauske_firekid wrote:
CelesteBlue wrote:
sauske_firekid wrote:I guess I'll have to discontinue this project because someone decided they were gonna make an identity tool instead. They claimed they started this as soon as henkaku was released, but I can't comment on that because their source code isn't up like mine. It's funny how I started this on the 6th of August, and already has tonnes of views so I thought word would go around. I guess not. Well my source code will still be up, and I might still push commits for my own personal use.
Don't worry, Freakler is a famous vita dev...
His project can be found here : https://mobile.twitter.com/freakler94/s ... 9779973121
You can always add missing features, or give him some ideas to make a more complete tool !
His source code isn't open. I'd rather update mine personally. I don't go along well with groups. If he had a github or something I wouldn't mind contributing though.

Yes, thank you very much for having shared your source code...
You help us to make homebrews...
Xyber
Posts: 1
Joined: Sat Aug 06, 2016 5:31 pm

Re: VITAident - Identity tool for PS Vita

Post by Xyber »

Hello , like a Major_Tom software , this get wrong ConsoleID ( idps ) , sorry bad english i'm brazilian
Post Reply

Return to “HENkaku”