This repository has been archived by the owner on Dec 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ZombieWizzard
committed
Aug 20, 2016
0 parents
commit 1125d96
Showing
10 changed files
with
592 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nbproject/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d)) | ||
|
||
TITLE_ID = ACTI00000 | ||
TARGET = vita-activator | ||
|
||
SRC_C :=$(call rwildcard, src/, *.c) | ||
|
||
OBJ_DIRS := $(addprefix out/, $(dir $(SRC_C:src/%.c=%.o))) | ||
OBJS := $(addprefix out/, $(SRC_C:src/%.c=%.o)) | ||
|
||
LIBS := -lSceKernel_stub -lSceVshBridge_stub -lSceSysmodule_stub -lSceNet_stub -lSceNetCtl_stub -lSceHttp_stub -lSceSsl_stub -lSceDisplay_stub -lSceReg_stub | ||
|
||
CC := arm-vita-eabi-gcc | ||
STRIP := arm-vita-eabi-strip | ||
|
||
CFLAGS += -Wl,-q -Wall -O3 | ||
ASFLAGS += $(CFLAGS) | ||
|
||
all: vpk eboot | ||
|
||
vpk: release/$(TARGET).vpk | ||
eboot: release/eboot.bin | ||
|
||
%.vpk: vpk/eboot.bin vpk/sce_sys/param.sfo | ||
cd vpk; zip -r -q ../$@ ./*; cd .. | ||
|
||
release/eboot.bin: vpk/eboot.bin | ||
cp vpk/eboot.bin release | ||
|
||
vpk/sce_sys/param.sfo: | ||
vita-mksfoex -s TITLE_ID=$(TITLE_ID) "$(TARGET)" $@ | ||
|
||
vpk/eboot.bin: out/$(TARGET).velf | ||
vita-make-fself $< $@ | ||
|
||
%.velf: %.elf | ||
vita-elf-create $< $@ | ||
|
||
%.elf: $(OBJS) | ||
$(CC) $(CFLAGS) $^ $(LIBS) -o $@ | ||
|
||
$(OBJ_DIRS): | ||
mkdir -p $@ | ||
|
||
out/%.o : src/%.c | $(OBJ_DIRS) | ||
$(CC) -c -o $@ $< | ||
|
||
clean: | ||
@rm -rf out/*.velf out/*.elf $(OBJS) release/* vpk/eboot.bin vpk/sce_sys/param.sfo |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/media/sf_projects/vita-activator |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
/* | ||
* PSP Software Development Kit - http://www.pspdev.org | ||
* ----------------------------------------------------------------------- | ||
* Licensed under the BSD license, see LICENSE in PSPSDK for details. | ||
* | ||
* font.c - Debug Font. | ||
* | ||
* Copyright (c) 2005 Marcus R. Brown <[email protected]> | ||
* Copyright (c) 2005 James Forshaw <[email protected]> | ||
* Copyright (c) 2005 John Kelley <[email protected]> | ||
* | ||
* $Id: font.c 540 2005-07-08 19:35:10Z warren $ | ||
*/ | ||
|
||
unsigned char msx[]= | ||
"\x00\x00\x00\x00\x00\x00\x00\x00\x3c\x42\xa5\x81\xa5\x99\x42\x3c" | ||
"\x3c\x7e\xdb\xff\xff\xdb\x66\x3c\x6c\xfe\xfe\xfe\x7c\x38\x10\x00" | ||
"\x10\x38\x7c\xfe\x7c\x38\x10\x00\x10\x38\x54\xfe\x54\x10\x38\x00" | ||
"\x10\x38\x7c\xfe\xfe\x10\x38\x00\x00\x00\x00\x30\x30\x00\x00\x00" | ||
"\xff\xff\xff\xe7\xe7\xff\xff\xff\x38\x44\x82\x82\x82\x44\x38\x00" | ||
"\xc7\xbb\x7d\x7d\x7d\xbb\xc7\xff\x0f\x03\x05\x79\x88\x88\x88\x70" | ||
"\x38\x44\x44\x44\x38\x10\x7c\x10\x30\x28\x24\x24\x28\x20\xe0\xc0" | ||
"\x3c\x24\x3c\x24\x24\xe4\xdc\x18\x10\x54\x38\xee\x38\x54\x10\x00" | ||
"\x10\x10\x10\x7c\x10\x10\x10\x10\x10\x10\x10\xff\x00\x00\x00\x00" | ||
"\x00\x00\x00\xff\x10\x10\x10\x10\x10\x10\x10\xf0\x10\x10\x10\x10" | ||
"\x10\x10\x10\x1f\x10\x10\x10\x10\x10\x10\x10\xff\x10\x10\x10\x10" | ||
"\x10\x10\x10\x10\x10\x10\x10\x10\x00\x00\x00\xff\x00\x00\x00\x00" | ||
"\x00\x00\x00\x1f\x10\x10\x10\x10\x00\x00\x00\xf0\x10\x10\x10\x10" | ||
"\x10\x10\x10\x1f\x00\x00\x00\x00\x10\x10\x10\xf0\x00\x00\x00\x00" | ||
"\x81\x42\x24\x18\x18\x24\x42\x81\x01\x02\x04\x08\x10\x20\x40\x80" | ||
"\x80\x40\x20\x10\x08\x04\x02\x01\x00\x10\x10\xff\x10\x10\x00\x00" | ||
"\x00\x00\x00\x00\x00\x00\x00\x00\x20\x20\x20\x20\x00\x00\x20\x00" | ||
"\x50\x50\x50\x00\x00\x00\x00\x00\x50\x50\xf8\x50\xf8\x50\x50\x00" | ||
"\x20\x78\xa0\x70\x28\xf0\x20\x00\xc0\xc8\x10\x20\x40\x98\x18\x00" | ||
"\x40\xa0\x40\xa8\x90\x98\x60\x00\x10\x20\x40\x00\x00\x00\x00\x00" | ||
"\x10\x20\x40\x40\x40\x20\x10\x00\x40\x20\x10\x10\x10\x20\x40\x00" | ||
"\x20\xa8\x70\x20\x70\xa8\x20\x00\x00\x20\x20\xf8\x20\x20\x00\x00" | ||
"\x00\x00\x00\x00\x00\x20\x20\x40\x00\x00\x00\x78\x00\x00\x00\x00" | ||
"\x00\x00\x00\x00\x00\x60\x60\x00\x00\x00\x08\x10\x20\x40\x80\x00" | ||
"\x70\x88\x98\xa8\xc8\x88\x70\x00\x20\x60\xa0\x20\x20\x20\xf8\x00" | ||
"\x70\x88\x08\x10\x60\x80\xf8\x00\x70\x88\x08\x30\x08\x88\x70\x00" | ||
"\x10\x30\x50\x90\xf8\x10\x10\x00\xf8\x80\xe0\x10\x08\x10\xe0\x00" | ||
"\x30\x40\x80\xf0\x88\x88\x70\x00\xf8\x88\x10\x20\x20\x20\x20\x00" | ||
"\x70\x88\x88\x70\x88\x88\x70\x00\x70\x88\x88\x78\x08\x10\x60\x00" | ||
"\x00\x00\x20\x00\x00\x20\x00\x00\x00\x00\x20\x00\x00\x20\x20\x40" | ||
"\x18\x30\x60\xc0\x60\x30\x18\x00\x00\x00\xf8\x00\xf8\x00\x00\x00" | ||
"\xc0\x60\x30\x18\x30\x60\xc0\x00\x70\x88\x08\x10\x20\x00\x20\x00" | ||
"\x70\x88\x08\x68\xa8\xa8\x70\x00\x20\x50\x88\x88\xf8\x88\x88\x00" | ||
"\xf0\x48\x48\x70\x48\x48\xf0\x00\x30\x48\x80\x80\x80\x48\x30\x00" | ||
"\xe0\x50\x48\x48\x48\x50\xe0\x00\xf8\x80\x80\xf0\x80\x80\xf8\x00" | ||
"\xf8\x80\x80\xf0\x80\x80\x80\x00\x70\x88\x80\xb8\x88\x88\x70\x00" | ||
"\x88\x88\x88\xf8\x88\x88\x88\x00\x70\x20\x20\x20\x20\x20\x70\x00" | ||
"\x38\x10\x10\x10\x90\x90\x60\x00\x88\x90\xa0\xc0\xa0\x90\x88\x00" | ||
"\x80\x80\x80\x80\x80\x80\xf8\x00\x88\xd8\xa8\xa8\x88\x88\x88\x00" | ||
"\x88\xc8\xc8\xa8\x98\x98\x88\x00\x70\x88\x88\x88\x88\x88\x70\x00" | ||
"\xf0\x88\x88\xf0\x80\x80\x80\x00\x70\x88\x88\x88\xa8\x90\x68\x00" | ||
"\xf0\x88\x88\xf0\xa0\x90\x88\x00\x70\x88\x80\x70\x08\x88\x70\x00" | ||
"\xf8\x20\x20\x20\x20\x20\x20\x00\x88\x88\x88\x88\x88\x88\x70\x00" | ||
"\x88\x88\x88\x88\x50\x50\x20\x00\x88\x88\x88\xa8\xa8\xd8\x88\x00" | ||
"\x88\x88\x50\x20\x50\x88\x88\x00\x88\x88\x88\x70\x20\x20\x20\x00" | ||
"\xf8\x08\x10\x20\x40\x80\xf8\x00\x70\x40\x40\x40\x40\x40\x70\x00" | ||
"\x00\x00\x80\x40\x20\x10\x08\x00\x70\x10\x10\x10\x10\x10\x70\x00" | ||
"\x20\x50\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf8\x00" | ||
"\x40\x20\x10\x00\x00\x00\x00\x00\x00\x00\x70\x08\x78\x88\x78\x00" | ||
"\x80\x80\xb0\xc8\x88\xc8\xb0\x00\x00\x00\x70\x88\x80\x88\x70\x00" | ||
"\x08\x08\x68\x98\x88\x98\x68\x00\x00\x00\x70\x88\xf8\x80\x70\x00" | ||
"\x10\x28\x20\xf8\x20\x20\x20\x00\x00\x00\x68\x98\x98\x68\x08\x70" | ||
"\x80\x80\xf0\x88\x88\x88\x88\x00\x20\x00\x60\x20\x20\x20\x70\x00" | ||
"\x10\x00\x30\x10\x10\x10\x90\x60\x40\x40\x48\x50\x60\x50\x48\x00" | ||
"\x60\x20\x20\x20\x20\x20\x70\x00\x00\x00\xd0\xa8\xa8\xa8\xa8\x00" | ||
"\x00\x00\xb0\xc8\x88\x88\x88\x00\x00\x00\x70\x88\x88\x88\x70\x00" | ||
"\x00\x00\xb0\xc8\xc8\xb0\x80\x80\x00\x00\x68\x98\x98\x68\x08\x08" | ||
"\x00\x00\xb0\xc8\x80\x80\x80\x00\x00\x00\x78\x80\xf0\x08\xf0\x00" | ||
"\x40\x40\xf0\x40\x40\x48\x30\x00\x00\x00\x90\x90\x90\x90\x68\x00" | ||
"\x00\x00\x88\x88\x88\x50\x20\x00\x00\x00\x88\xa8\xa8\xa8\x50\x00" | ||
"\x00\x00\x88\x50\x20\x50\x88\x00\x00\x00\x88\x88\x98\x68\x08\x70" | ||
"\x00\x00\xf8\x10\x20\x40\xf8\x00\x18\x20\x20\x40\x20\x20\x18\x00" | ||
"\x20\x20\x20\x00\x20\x20\x20\x00\xc0\x20\x20\x10\x20\x20\xc0\x00" | ||
"\x40\xa8\x10\x00\x00\x00\x00\x00\x00\x00\x20\x50\xf8\x00\x00\x00" | ||
"\x70\x88\x80\x80\x88\x70\x20\x60\x90\x00\x00\x90\x90\x90\x68\x00" | ||
"\x10\x20\x70\x88\xf8\x80\x70\x00\x20\x50\x70\x08\x78\x88\x78\x00" | ||
"\x48\x00\x70\x08\x78\x88\x78\x00\x20\x10\x70\x08\x78\x88\x78\x00" | ||
"\x20\x00\x70\x08\x78\x88\x78\x00\x00\x70\x80\x80\x80\x70\x10\x60" | ||
"\x20\x50\x70\x88\xf8\x80\x70\x00\x50\x00\x70\x88\xf8\x80\x70\x00" | ||
"\x20\x10\x70\x88\xf8\x80\x70\x00\x50\x00\x00\x60\x20\x20\x70\x00" | ||
"\x20\x50\x00\x60\x20\x20\x70\x00\x40\x20\x00\x60\x20\x20\x70\x00" | ||
"\x50\x00\x20\x50\x88\xf8\x88\x00\x20\x00\x20\x50\x88\xf8\x88\x00" | ||
"\x10\x20\xf8\x80\xf0\x80\xf8\x00\x00\x00\x6c\x12\x7e\x90\x6e\x00" | ||
"\x3e\x50\x90\x9c\xf0\x90\x9e\x00\x60\x90\x00\x60\x90\x90\x60\x00" | ||
"\x90\x00\x00\x60\x90\x90\x60\x00\x40\x20\x00\x60\x90\x90\x60\x00" | ||
"\x40\xa0\x00\xa0\xa0\xa0\x50\x00\x40\x20\x00\xa0\xa0\xa0\x50\x00" | ||
"\x90\x00\x90\x90\xb0\x50\x10\xe0\x50\x00\x70\x88\x88\x88\x70\x00" | ||
"\x50\x00\x88\x88\x88\x88\x70\x00\x20\x20\x78\x80\x80\x78\x20\x20" | ||
"\x18\x24\x20\xf8\x20\xe2\x5c\x00\x88\x50\x20\xf8\x20\xf8\x20\x00" | ||
"\xc0\xa0\xa0\xc8\x9c\x88\x88\x8c\x18\x20\x20\xf8\x20\x20\x20\x40" | ||
"\x10\x20\x70\x08\x78\x88\x78\x00\x10\x20\x00\x60\x20\x20\x70\x00" | ||
"\x20\x40\x00\x60\x90\x90\x60\x00\x20\x40\x00\x90\x90\x90\x68\x00" | ||
"\x50\xa0\x00\xa0\xd0\x90\x90\x00\x28\x50\x00\xc8\xa8\x98\x88\x00" | ||
"\x00\x70\x08\x78\x88\x78\x00\xf8\x00\x60\x90\x90\x90\x60\x00\xf0" | ||
"\x20\x00\x20\x40\x80\x88\x70\x00\x00\x00\x00\xf8\x80\x80\x00\x00" | ||
"\x00\x00\x00\xf8\x08\x08\x00\x00\x84\x88\x90\xa8\x54\x84\x08\x1c" | ||
"\x84\x88\x90\xa8\x58\xa8\x3c\x08\x20\x00\x00\x20\x20\x20\x20\x00" | ||
"\x00\x00\x24\x48\x90\x48\x24\x00\x00\x00\x90\x48\x24\x48\x90\x00" | ||
"\x28\x50\x20\x50\x88\xf8\x88\x00\x28\x50\x70\x08\x78\x88\x78\x00" | ||
"\x28\x50\x00\x70\x20\x20\x70\x00\x28\x50\x00\x20\x20\x20\x70\x00" | ||
"\x28\x50\x00\x70\x88\x88\x70\x00\x50\xa0\x00\x60\x90\x90\x60\x00" | ||
"\x28\x50\x00\x88\x88\x88\x70\x00\x50\xa0\x00\xa0\xa0\xa0\x50\x00" | ||
"\xfc\x48\x48\x48\xe8\x08\x50\x20\x00\x50\x00\x50\x50\x50\x10\x20" | ||
"\xc0\x44\xc8\x54\xec\x54\x9e\x04\x10\xa8\x40\x00\x00\x00\x00\x00" | ||
"\x00\x20\x50\x88\x50\x20\x00\x00\x88\x10\x20\x40\x80\x28\x00\x00" | ||
"\x7c\xa8\xa8\x68\x28\x28\x28\x00\x38\x40\x30\x48\x48\x30\x08\x70" | ||
"\x00\x00\x00\x00\x00\x00\xff\xff\xf0\xf0\xf0\xf0\x0f\x0f\x0f\x0f" | ||
"\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00" | ||
"\x00\x00\x00\x3c\x3c\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00" | ||
"\xc0\xc0\xc0\xc0\xc0\xc0\xc0\xc0\x0f\x0f\x0f\x0f\xf0\xf0\xf0\xf0" | ||
"\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\x03\x03\x03\x03\x03\x03\x03\x03" | ||
"\x3f\x3f\x3f\x3f\x3f\x3f\x3f\x3f\x11\x22\x44\x88\x11\x22\x44\x88" | ||
"\x88\x44\x22\x11\x88\x44\x22\x11\xfe\x7c\x38\x10\x00\x00\x00\x00" | ||
"\x00\x00\x00\x00\x10\x38\x7c\xfe\x80\xc0\xe0\xf0\xe0\xc0\x80\x00" | ||
"\x01\x03\x07\x0f\x07\x03\x01\x00\xff\x7e\x3c\x18\x18\x3c\x7e\xff" | ||
"\x81\xc3\xe7\xff\xff\xe7\xc3\x81\xf0\xf0\xf0\xf0\x00\x00\x00\x00" | ||
"\x00\x00\x00\x00\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x00\x00\x00\x00" | ||
"\x00\x00\x00\x00\xf0\xf0\xf0\xf0\x33\x33\xcc\xcc\x33\x33\xcc\xcc" | ||
"\x00\x20\x20\x50\x50\x88\xf8\x00\x20\x20\x70\x20\x70\x20\x20\x00" | ||
"\x00\x00\x00\x50\x88\xa8\x50\x00\xff\xff\xff\xff\xff\xff\xff\xff" | ||
"\x00\x00\x00\x00\xff\xff\xff\xff\xf0\xf0\xf0\xf0\xf0\xf0\xf0\xf0" | ||
"\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\xff\xff\xff\xff\x00\x00\x00\x00" | ||
"\x00\x00\x68\x90\x90\x90\x68\x00\x30\x48\x48\x70\x48\x48\x70\xc0" | ||
"\xf8\x88\x80\x80\x80\x80\x80\x00\xf8\x50\x50\x50\x50\x50\x98\x00" | ||
"\xf8\x88\x40\x20\x40\x88\xf8\x00\x00\x00\x78\x90\x90\x90\x60\x00" | ||
"\x00\x50\x50\x50\x50\x68\x80\x80\x00\x50\xa0\x20\x20\x20\x20\x00" | ||
"\xf8\x20\x70\xa8\xa8\x70\x20\xf8\x20\x50\x88\xf8\x88\x50\x20\x00" | ||
"\x70\x88\x88\x88\x50\x50\xd8\x00\x30\x40\x40\x20\x50\x50\x50\x20" | ||
"\x00\x00\x00\x50\xa8\xa8\x50\x00\x08\x70\xa8\xa8\xa8\x70\x80\x00" | ||
"\x38\x40\x80\xf8\x80\x40\x38\x00\x70\x88\x88\x88\x88\x88\x88\x00" | ||
"\x00\xf8\x00\xf8\x00\xf8\x00\x00\x20\x20\xf8\x20\x20\x00\xf8\x00" | ||
"\xc0\x30\x08\x30\xc0\x00\xf8\x00\x18\x60\x80\x60\x18\x00\xf8\x00" | ||
"\x10\x28\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\xa0\x40" | ||
"\x00\x20\x00\xf8\x00\x20\x00\x00\x00\x50\xa0\x00\x50\xa0\x00\x00" | ||
"\x00\x18\x24\x24\x18\x00\x00\x00\x00\x30\x78\x78\x30\x00\x00\x00" | ||
"\x00\x00\x00\x00\x30\x00\x00\x00\x3e\x20\x20\x20\xa0\x60\x20\x00" | ||
"\xa0\x50\x50\x50\x00\x00\x00\x00\x40\xa0\x20\x40\xe0\x00\x00\x00" | ||
"\x00\x38\x38\x38\x38\x38\x38\x00\x00\x00\x00\x00\x00\x00\x00"; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
#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; | ||
} | ||
|
||
void *psvDebugScreenGetVram() { | ||
return g_vram_base; | ||
} | ||
|
||
int psvDebugScreenGetX() { | ||
return gX; | ||
} | ||
|
||
int psvDebugScreenGetY() { | ||
return gY; | ||
} | ||
|
||
void psvDebugScreenSetXY(int x, int y) { | ||
gX = x; | ||
gY = y; | ||
} | ||
|
||
// #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 }; | ||
opt.size = sizeof(opt); | ||
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; | ||
|
||
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 + 16 > SCREEN_WIDTH) { | ||
gY += 16; | ||
gX = 0; | ||
} | ||
if (gY + 16 > SCREEN_HEIGHT) { | ||
gY = 0; | ||
psvDebugScreenClear(g_bg_color); | ||
} | ||
char ch = text[c]; | ||
if (ch == '\n') { | ||
gX = 0; | ||
gY += 16; | ||
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))) { | ||
*(uint32_t *)(vram_ptr) = g_fg_color; | ||
*(uint32_t *)(vram_ptr + 1) = g_fg_color; | ||
*(uint32_t *)(vram_ptr + LINE_SIZE) = g_fg_color; | ||
*(uint32_t *)(vram_ptr + LINE_SIZE + 1) = g_fg_color; | ||
} else { | ||
*(uint32_t *)(vram_ptr) = g_bg_color; | ||
*(uint32_t *)(vram_ptr + 1) = g_bg_color; | ||
*(uint32_t *)(vram_ptr + LINE_SIZE) = g_bg_color; | ||
*(uint32_t *)(vram_ptr + LINE_SIZE + 1) = g_bg_color; | ||
} | ||
vram_ptr += 2; | ||
} | ||
vram += 2 * LINE_SIZE; | ||
} | ||
gX += 16; | ||
} | ||
} | ||
|
||
void psvDebugScreenPrintf(const char *format, ...) { | ||
char buf[1024]; | ||
|
||
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; | ||
} |
Oops, something went wrong.