Skip to content

Commit

Permalink
Add ps2 VMC management (#168)
Browse files Browse the repository at this point in the history
* add ps2 vmc code
* load ps2 icons
* import cbs, xps, max  ps2 saves
* scan VMCs from HDD
* improve online db
  • Loading branch information
bucanero authored Oct 26, 2024
1 parent d5b210b commit dced366
Show file tree
Hide file tree
Showing 30 changed files with 10,034 additions and 123 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set env vars
run: |
Expand All @@ -29,7 +29,7 @@ jobs:
- name: Cache OpenOrbis Toolchain
id: cache-oosdk
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.OO_PS4_TOOLCHAIN }}
key: ${{ runner.os }}-oosdk-llvm-${{ env.llvm_ver }}
Expand All @@ -39,7 +39,7 @@ jobs:
run: curl -sL https://github.com/illusion0001/OpenOrbis-PS4-Toolchain/releases/download/0.0.1.416/toolchain.tar.gz | tar xz -C ./

- name: Checkout oosdk_libraries
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: bucanero/oosdk_libraries
path: oosdk_libraries
Expand All @@ -53,63 +53,63 @@ jobs:
curl https://raw.githubusercontent.com/OpenOrbis/OpenOrbis-PS4-Toolchain/master/include/orbis/_types/user.h > OpenOrbis/PS4Toolchain/include/orbis/_types/user.h
- name: Checkout dbglogger
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: bucanero/dbglogger
path: dbglogger

- name: Checkout apollo-lib
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: bucanero/apollo-lib
path: apollo-lib

- name: Checkout SQLite
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: bucanero/libSQLite-ps4
path: libSQLite-ps4

- name: Checkout SDL-PS4
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: bucanero/SDL-PS4
path: ${{ env.sdl_path }}
ref: ps4

- name: Checkout mxml
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: bucanero/mxml
path: mxml

- name: Checkout libunrar
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: bucanero/libunrar-ps3
path: libunrar-ps3

- name: Checkout libun7zip
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: bucanero/libun7zip
path: libun7zip

- name: Checkout libjbc
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: bucanero/ps4-libjbc
path: ps4-libjbc

- name: Checkout libs3m
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: bucanero/s3mplay
path: s3mplay

- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./llvm
key: llvm-${{ env.llvm_ver }}
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:

- name: Cache SDL2
id: cache-sdl2
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.sdl_path }}/orbis/libSDL2.a
key: ${{ runner.os }}-sdl2
Expand All @@ -186,7 +186,7 @@ jobs:
- name: Cache curl
id: cache-curl
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.curl_path }}/orbis/lib/libcurl.a
key: ${{ runner.os }}-curl
Expand Down Expand Up @@ -214,7 +214,7 @@ jobs:
mv IV0000-APOL00004_00-APOLLO0000000PS4.pkg apollo-ps4-build_${{ env.sha_name }}.pkg
- name: Push package artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: apollo-ps4-build_${{ env.sha_name }}
path: apollo-ps4-build_${{ env.sha_name }}.pkg
Expand Down
Binary file removed assets/images/tag_pce.png
Binary file not shown.
Binary file added assets/images/tag_vmc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 1 addition & 16 deletions include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,6 @@ int mkdirs(const char* dir);
int copy_file(const char* input, const char* output);
int copy_directory(const char* startdir, const char* inputdir, const char* outputdir);
int clean_directory(const char* inputdir);

//----------------------------------------
//CONSOLE ID UTILS
//----------------------------------------

int ss_aim_get_device_id(uint8_t *idps);
int ss_aim_get_open_psid(uint8_t *psid);
int sys_ss_get_open_psid(uint64_t psid[2]);
int is_ps3hen(void);

//----------------------------------------
//POWER UTILS
//----------------------------------------

int sys_shutdown();
int sys_reboot();
uint32_t file_crc32(const char* input);

#endif
2 changes: 1 addition & 1 deletion include/font-10x20.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// https://github.com/idispatch/raster-fonts
unsigned char console_font_10x20[] = {
static const unsigned char console_font_10x20[] = {

/*
* code=0, hex=0x00, ascii="^@"
Expand Down
9 changes: 9 additions & 0 deletions include/lzari.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef LIBRARIES_LZARI_H
#define LIBRARIES_LZARI_H

// Compress in to out using LZARI. Returns final compressed size.
int lzari(unsigned char *in, int insz, unsigned char *out, int outsz);
// Deompress in to out using LZARI. Return final decompressed size.
int unlzari(unsigned char *in, int insz, unsigned char *out, int outsz);

#endif
131 changes: 131 additions & 0 deletions include/mcio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/*
* ps3mca-tool - PlayStation 3 Memory Card Adaptor Software
* Copyright (C) 2011 - jimmikaelkael <jimmikaelkael@wanadoo.fr>
* Copyright (C) 2011 - "someone who wants to stay anonymous"
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef __MCIO_H__
#define __MCIO_H__

#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>

struct sceMcStDateTime {
uint8_t Resv2;
uint8_t Sec;
uint8_t Min;
uint8_t Hour;
uint8_t Day;
uint8_t Month;
uint16_t Year;
} __attribute__((packed));

struct MCFsEntry { /* size = 512 */
uint16_t mode;
uint16_t unused;
uint32_t length;
struct sceMcStDateTime created;
uint32_t cluster;
uint32_t dir_entry;
struct sceMcStDateTime modified;
uint32_t attr;
uint32_t unused2[7];
char name[32];
uint8_t unused3[416];
} __attribute__((packed));

struct io_stat {
uint32_t mode;
uint32_t attr;
uint32_t size;
struct sceMcStDateTime ctime;
struct sceMcStDateTime mtime;
} __attribute__((packed));

struct io_dirent {
struct io_stat stat;
char name[256];
uint32_t unknown;
} __attribute__((packed));

int mcio_vmcInit(const char* vmc);
int mcio_vmcExportImage(const char *dst, int ecc);
int mcio_vmcImportImage(const char *src);
void mcio_vmcFinish(void);
int mcio_mcDetect(void);
int mcio_mcGetInfo(int *pagesize, int *blocksize, int *cardsize, int *cardflags);
int mcio_mcGetAvailableSpace(int *cardfree);
int mcio_mcOpen(const char *filename, int flag);
int mcio_mcClose(int fd);
int mcio_mcRead(int fd, void *buf, int length);
int mcio_mcWrite(int fd, void *buf, int length);
int mcio_mcSeek(int fd, int offset, int origin);
int mcio_mcCreateCrossLinkedFile(const char *real_filename, const char *dummy_filename);
int mcio_mcDopen(const char *dirname);
int mcio_mcDclose(int fd);
int mcio_mcDread(int fd, struct io_dirent *dirent);
int mcio_mcMkDir(const char *dirname);
int mcio_mcReadPage(int pagenum, void *buf, void *ecc);
int mcio_mcUnformat(void);
int mcio_mcFormat(void);
int mcio_mcRemove(const char *filename);
int mcio_mcRmDir(const char *dirname);
int mcio_mcStat(const char *filename, struct io_dirent *dirent);
int mcio_mcSetStat(const char *filename, const struct io_dirent *dirent);

/* MC error codes */
#define sceMcResSucceed 0
#define sceMcResChangedCard -1
#define sceMcResNoFormat -2
#define sceMcResFullDevice -3
#define sceMcResNoEntry -4
#define sceMcResDeniedPermit -5
#define sceMcResNotEmpty -6
#define sceMcResUpLimitHandle -7
#define sceMcResFailReplace -8
#define sceMcResFailResetAuth -11
#define sceMcResFailDetect -12
#define sceMcResFailDetect2 -13
#define sceMcResFailReadCluster -21
#define sceMcResFailCheckBackupBlocks -47
#define sceMcResFailIO -48
#define sceMcResFailSetDeviceSpecs -49
#define sceMcResDeniedPS1Permit -51
#define sceMcResFailAuth -90
#define sceMcResNotDir -100
#define sceMcResNotFile -101

/* file attributes */
#ifndef sceMcFileAttrReadable
#define sceMcFileAttrReadable 0x0001
#define sceMcFileAttrWriteable 0x0002
#define sceMcFileAttrExecutable 0x0004
#define sceMcFileAttrDupProhibit 0x0008
#define sceMcFileAttrFile 0x0010
#define sceMcFileAttrSubdir 0x0020
#define sceMcFileCreateDir 0x0040
#define sceMcFileAttrClosed 0x0080
#define sceMcFileCreateFile 0x0200
#define sceMcFile0400 0x0400
#define sceMcFileAttrPDAExec 0x0800
#define sceMcFileAttrPS1 0x1000
#define sceMcFileAttrHidden 0x2000
#define sceMcFileAttrExists 0x8000
#endif

#endif

5 changes: 4 additions & 1 deletion include/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ enum menu_screen_ids
MENU_CODE_OPTIONS, /* 10 - Code Menu (View Cheat Options) */
MENU_SAVE_DETAILS,
MENU_HEX_EDITOR,
MENU_PS1VMC_SAVES, /* 13 - PS1 VMC Menu */
MENU_PS2VMC_SAVES, /* 14 - PS2 VMC Menu */
TOTAL_MENU_IDS
};

Expand Down Expand Up @@ -68,7 +70,7 @@ enum texture_index
cat_warning_png_index,
tag_lock_png_index,
tag_own_png_index,
tag_pce_png_index,
tag_vmc_png_index,
tag_ps1_png_index,
tag_ps2_png_index,
tag_ps3_png_index,
Expand Down Expand Up @@ -252,6 +254,7 @@ extern void Draw_MainMenu_Ani(void);
extern void Draw_HexEditor(const hexedit_data_t* hex);
extern void Draw_HexEditor_Ani(const hexedit_data_t* hex);
int LoadMenuTexture(const char* path, int idx);
void LoadVmcTexture(int width, int height, uint8_t* icon);
void initMenuOptions(void);

void drawScene(void);
Expand Down
Loading

0 comments on commit dced366

Please sign in to comment.