Skip to content

Commit

Permalink
Merge branch 'ps1cfw'
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseAaronLopezGarcia committed Jul 3, 2023
2 parents 9115db2 + 4711a9d commit 441108b
Show file tree
Hide file tree
Showing 14 changed files with 157 additions and 12 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# ARK Changelog

## Version 4.20.60 (2023-??-??):
- ???
- Implement UNIX-style hidden files/folders in `Custom Launcher` (and `Recovery`).
- `Custom Laucher` (and `Recovery`) will now remember last folder used in `File Browser`.
- Updated and added new translations.
- Improved lots of text displayed in the `Custom Launcher` (and `Recovery`) when using translations.
- `File Browser` can now display game icons and animations.
- Added option to disable file size calculation in `File Browser`.
- A progress bar is now displayed when downloading an update in the `Custom Launcher`.
- Fixed graphical glitch when loading the `Custom Launcher` or `Recovery`.
- Several other fixes and improvements.

## Version 4.20.59 (2023-06-27):
- https://github.com/PSP-Archive/ARK-4/releases/tag/r42059
- Heavily improved and refactor of VSH Menu.
- Text Editor will now ask you to save when closing a modified file.
- You can now copy game information to use on Text Editor.
- Several other fixes and improvements.

## Version 4.20.58 (2023-06-24)
- https://github.com/PSP-Archive/ARK-4/releases/tag/r42058
- Added support for `PS Vita Standalone` installations using `NoPspEmuDrm`.
Expand Down
2 changes: 1 addition & 1 deletion common/include/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#define ARK_BIN_MAX_SIZE 0x8000
#define ARK_MAJOR_VERSION 4
#define ARK_MINOR_VERSION 20
#define ARK_MICRO_VERSION 59
#define ARK_MICRO_VERSION 60
#define ARK_REVISION 0
#define MAX_FLASH0_SIZE 0x32000

Expand Down
4 changes: 0 additions & 4 deletions core/compat/pentazemin/syspatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,6 @@ void AdrenalineOnModuleStart(SceModule2 * mod){
// System fully booted Status
static int booted = 0;

if (strcmp(mod->modname, "ARK VitaPOPS Loader") == 0){
SendAdrenalineCmd(ADRENALINE_VITA_CMD_PAUSE_POPS);
}

if(strcmp(mod->modname, "sceDisplay_Service") == 0)
{
// can use screen now
Expand Down
5 changes: 5 additions & 0 deletions core/compat/vitapops/popsdisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

// TN-X patches for PSX exploits on Vita

#define PSP_SCREEN_WIDTH 480
#define PSP_SCREEN_HEIGHT 272
#define PSP_SCREEN_LINE 512
#define SCE_PSPEMU_FRAMEBUFFER_SIZE 0x88000

#define MAX_VRAM_CONFIGS 2
typedef struct POPSVramConfig{
short x;
Expand Down
65 changes: 64 additions & 1 deletion core/compat/vitapops/syspatch.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <pspsdk.h>
#include <globals.h>
#include <graphics.h>
#include <macros.h>
#include <module2.h>
#include <pspdisplay_kernel.h>
Expand All @@ -10,12 +9,20 @@
#include <systemctrl_private.h>
#include <pspiofilemgr.h>
#include <pspgu.h>
#include <pspinit.h>
#include <functions.h>
#include "popsdisplay.h"

extern ARKConfig* ark_config;
extern STMOD_HANDLER previous;

static int draw_thread = -1;
static int do_draw = 0;
static u32* g_vram_base = (u32*)0x44000000;
int (* DisplaySetFrameBuf)(void*, int, int, int) = NULL;
int (*DisplayWaitVblankStart)() = NULL;


KernelFunctions _ktbl = {
.KernelDcacheInvalidateRange = &sceKernelDcacheInvalidateRange,
.KernelIcacheInvalidateAll = &sceKernelIcacheInvalidateAll,
Expand Down Expand Up @@ -62,12 +69,56 @@ void patchVitaPopsDisplay(SceModule2* mod){
}
}

int pops_draw_thread(int argc, void* argp){

while (do_draw){
SoftRelocateVram(g_vram_base, NULL);
DisplayWaitVblankStart();
}

return 0;
}

int sceKernelSuspendThreadPatched(SceUID thid) {
SceKernelThreadInfo info;
info.size = sizeof(SceKernelThreadInfo);
if (sceKernelReferThreadStatus(thid, &info) == 0) {
if (strcmp(info.name, "popsmain") == 0) {
if (draw_thread < 0){
do_draw = 1;
draw_thread = sceKernelCreateThread("psxloader", &pops_draw_thread, 0x10, 0x10000, PSP_THREAD_ATTR_VFPU, NULL);
sceKernelStartThread(draw_thread, 0, NULL);
}
}
}

return sceKernelSuspendThread(thid);
}

int sceKernelResumeThreadPatched(SceUID thid) {
SceKernelThreadInfo info;
info.size = sizeof(SceKernelThreadInfo);
if (sceKernelReferThreadStatus(thid, &info) == 0) {
if (strcmp(info.name, "popsmain") == 0) {
if (draw_thread >= 0){
do_draw = 0;
sceKernelWaitThreadEnd(draw_thread, NULL);
draw_thread = -1;
}
}
}

return sceKernelResumeThread(thid);
}

void ARKVitaPopsOnModuleStart(SceModule2 * mod){

static int booted = 0;

// Patch display in PSX exploits
if(strcmp(mod->modname, "sceDisplay_Service") == 0) {
DisplaySetFrameBuf = (void*)sctrlHENFindFunction("sceDisplay_Service", "sceDisplay", 0x289D82FE);
DisplayWaitVblankStart = (void*)sctrlHENFindFunction("sceDisplay_Service", "sceDisplay", 0x984C27E7);
patchVitaPopsDisplay(mod);
goto flush;
}
Expand All @@ -79,12 +130,24 @@ void ARKVitaPopsOnModuleStart(SceModule2 * mod){
goto flush;
}

if (strcmp(mod->modname, "CWCHEATPRX") == 0) {
if (sceKernelInitKeyConfig() == PSP_INIT_KEYCONFIG_POPS) {
hookImportByNID(mod, "ThreadManForKernel", 0x9944F31F, sceKernelSuspendThreadPatched);
hookImportByNID(mod, "ThreadManForKernel", 0x75156E8F, sceKernelResumeThreadPatched);
goto flush;
}
}

// Boot Complete Action not done yet
if(booted == 0)
{
// Boot is complete
if(isSystemBooted())
{
// Set fake framebuffer so that cwcheat can be displayed
DisplaySetFrameBuf((void *)g_vram_base, PSP_SCREEN_LINE, PSP_DISPLAY_PIXEL_FORMAT_8888, PSP_DISPLAY_SETBUF_NEXTFRAME);
memset((void *)g_vram_base, 0, SCE_PSPEMU_FRAMEBUFFER_SIZE);

// Boot Complete Action done
booted = 1;
goto flush;
Expand Down
1 change: 1 addition & 0 deletions extras/menus/arkMenu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ OBJS = \
src/browser.o \
src/browser_entries.o \
src/osk.o \
src/usb.o \
src/network.o \
src/settingsmenu.o \
src/optionsmenu.o \
Expand Down
2 changes: 1 addition & 1 deletion extras/menus/arkMenu/include/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ extern int initializeNetwork(void);
extern int connect_to_apctl(void);
extern int shutdownNetwork();
extern char* resolveHostAddress(char*);
extern int wget(char* url, char* saveAs);
extern int wget(char* url, char* saveAs, SceULong64* cur_download, SceULong64* max_download);

#endif
12 changes: 12 additions & 0 deletions extras/menus/arkMenu/include/usb.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef USB_H
#define USB_H

#include <string>

namespace USB{
extern bool is_enabled;
extern void enable();
extern void disable();
};

#endif
13 changes: 11 additions & 2 deletions extras/menus/arkMenu/src/net_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ static struct {
static SceUID ftp_thread = -1;
static char pspIpAddr[32];

static SceULong64 cur_download=0, max_download=0;

static void addMessage(const char* msg){
if (msg==NULL)
return;
Expand Down Expand Up @@ -83,6 +85,13 @@ void NetworkManager::draw(){
common::printText(30, y, vla.msg[i].c_str());
y+=20;
}

if (max_download){
double percent = double(cur_download)/double(max_download);
ya2d_draw_rect(20, 265, 450, 5, DARKGRAY, 1);
ya2d_draw_rect(20, 266, 450*percent, 3, LITEGRAY, 1);
}

break;
case 1:
if (w > 0 || h > 0){
Expand Down Expand Up @@ -246,7 +255,7 @@ static void checkUpdates(){

addMessage("Downloading psp-updatelist.txt");

wget((char*)path.c_str(), "psp-updatelist.txt");
wget((char*)path.c_str(), "psp-updatelist.txt", &cur_download, &max_download);

updater_url = parsePspUpdateList(&update_ver);

Expand All @@ -263,7 +272,7 @@ static void checkUpdates(){
else{
addMessage("Downloading updater");
sceIoMkdir(update_folder, 0777);
wget((char*)updater_url.c_str(), update_eboot);
wget((char*)updater_url.c_str(), update_eboot, &cur_download, &max_download);
}

update_end:
Expand Down
5 changes: 4 additions & 1 deletion extras/menus/arkMenu/src/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,20 @@ int connect_to_apctl(void)
return 0;
}

int wget(char* url, char* saveAs){
int wget(char* url, char* saveAs, SceULong64* cur_download, SceULong64* max_download){
int tpl, cnx, req, ret;
u8 buf[16*1024];
if((tpl=sceHttpCreateTemplate("ARK-Launcher/1.0", 1, 1))<0)return tpl;
if((cnx=sceHttpCreateConnectionWithURL(tpl, url, 0))<0)return cnx;
if((req=sceHttpCreateRequestWithURL(cnx, PSP_HTTP_METHOD_GET, url, 0))<0)return req;
if((ret=sceHttpSendRequest(req, 0, 0))<0)return ret;
*cur_download = 0;
sceHttpGetContentLength(req, max_download);
if(saveAs){
SceUID fd=sceIoOpen(saveAs, PSP_O_WRONLY | PSP_O_CREAT, 0777);
while((ret=sceHttpReadData(req,buf,sizeof(buf)))>0){
sceIoWrite(fd,buf,ret);
*cur_download += ret;
}
ret=sceIoClose(fd);
}else{//store in ram
Expand Down
35 changes: 35 additions & 0 deletions extras/menus/arkMenu/src/usb.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "usb.h"
#include "common.h"

bool USB::is_enabled = false;
static SceUID usbdev_id = -1;

void USB::enable(){
if (is_enabled) return;
ARKConfig* ark_conf = common::getArkConfig();
if (IS_PSP(ark_conf)){
// load/start USBDEV.PRX

is_enabled = true;
}
else if (IS_VITA_ADR(ark_conf)){
// call sctrlStartUsb

is_enabled = true;
}
}

void USB::disable(){
if (!is_enabled) return;
ARKConfig* ark_conf = common::getArkConfig();
if (IS_PSP(ark_conf)){
// stop/unload USBDEV.PRX

is_enabled = false;
}
else if (IS_VITA_ADR(ark_conf)){
// call sctrlStopUsb

is_enabled = false;
}
}
1 change: 1 addition & 0 deletions extras/menus/recovery/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ OBJS = \
../arkMenu/src/entry.o \
../arkMenu/src/eboot.o \
../arkMenu/src/iso.o \
../arkMenu/src/usb.o \
../arkMenu/src/browser.o \
../arkMenu/src/browser_entries.o \
../arkMenu/src/settingsmenu.o \
Expand Down
1 change: 1 addition & 0 deletions loader/live/user/psxloader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ BUILD_PRX=1
PSPSDK = $(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak

#ChovySign-CLI --pops psxloader.cue --pops-info "ARK-X" ICON0.PNG --pops-eboot psxloader.prx --no-psvimg --vkey-gen act.dat license.rif 000000000000000000000000 2 --rif license.rif
simple.h:
$(Q)bin2c simple.psp simple.h simple
$(Q)mkpsxiso psxloader.xml
Expand Down
4 changes: 2 additions & 2 deletions loader/live/user/psxloader/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern int sceKernelPowerLock(unsigned int, unsigned int);
volatile ARKConfig config = {
.magic = ARK_CONFIG_MAGIC,
.arkpath = DEFAULT_ARK_PATH, // only ms0 available anyways
.launcher = {0}, // use default (if needed)
.launcher = ARK_XMENU, // use default (if needed)
.exec_mode = PSV_POPS, // set to Vita Pops mode
.exploit_id = "ePSX", // ps1 loader name
.recovery = 0,
Expand Down Expand Up @@ -149,7 +149,7 @@ int module_start(SceSize args, void* argp)
{

int thid = sceKernelCreateThread("psxloader", &psxloader_thread, 0x10, 0x10000, PSP_THREAD_ATTR_USER|PSP_THREAD_ATTR_VFPU, NULL);
sceKernelStartThread(thid, 0, NULL);
sceKernelStartThread(thid, 0, NULL);

return 0;
}

0 comments on commit 441108b

Please sign in to comment.