A library/wrapper created by myself inspired on ps2_drivers by fjtrujy that makes easy to print on the screen with one declaration without any burrocracy, it´s gonna be using firstly on doomgeneric-ps2 and Wolf4SDL
Youtube: https://www.youtube.com/channel/UCzMnDI1qhD6egKLMTezysxg
Discord: Wolf3s#6897
Github: https://github.com/wolfysdl
When i was trying to upgrade the dooomgeneric-ps2 by
Arawn-Davies Arawn was having difficult to make the scr_printf
work yesterday.
so i decided to implement a wraaper(initially) and when it worked i felt realized so, i thinked to work more on this and this makes the libps2_printf surges.
Install ps2dev and his whole package and then:
$ make install to get the library running.
to link the library just copy and past this on the Makefile
EE_LIBS += -lps2_printf -ldebug
Let me put an example based on the helloworld sample, which we will compare Before vs After to see how
easy this library can be.
Makefile
EE_LIBS += -ldebug -lc
main.c
/*
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
*/
#include <stdio.h>
#include <tamtypes.h>
#include <sifrpc.h>
#include <debug.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
SifInitRpc(0);
init_scr();
scr_printf("Hello, World!\n");
// After 5 seconds, clear the screen.
sleep(5);
scr_clear();
// Move cursor to 20, 20
scr_setXY(20, 20);
scr_printf("Hello Again, World!\n");
sleep(10);
return 0;
}Makefile
LIBS += -lps2_printf -ldebug -lcmain.c
/*
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
*/
#include <ps2_printf.h>
#include <sifppc.h>
int main(int argc, char *argv[])
{
SifInitRpc(0);
//Print the screen and then after 5 seconds clear the screen.
ps2_printf("Hello, World!\n", 5);
// Prints the screen once again but move the cursor to 20 20
// after 10 seconds
ps2_printf_XY("Hello again, World\n", 10, 20, 20);
return 0;
}beautiful isn´t it?
callstacktest(ported from ps2sdk).
Description: Call the stack test on the screen.
helloworld(ported from ps2sdk), helloworld-cpp(ported from ps2sdk) and helloworld-cpp-2(ported from ps2sdk). Description: Normal hello world.
Description: Some printfs showcase.
BSD 2-Clause license
André Guilherme
- Solve the problem with integers