Skip to content

Commit

Permalink
add offline db
Browse files Browse the repository at this point in the history
Update CHANGELOG.md
  • Loading branch information
bucanero committed Dec 23, 2024
1 parent 1387d73 commit 2f97337
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 14 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ All notable changes to the `apollo-ps2` project will be documented in this file.

## [Unreleased]()

## [v1.0.2](https://github.com/bucanero/apollo-ps2/releases/tag/v1.0.2) - 2024-12-24

### Added

* Support additional PS2 save formats when importing to PS2 VMCs
- Import to VMC - New supported formats: `.MAX`, `.CBS`, `.XPS`, `.SPS`
* Add support to load an offline save database (from `cdfs:/`, `mass:/`)
- Note: requires `mass` drive to be available to unzip save files

### Fixed

* Solve issue when exporting PS1 saves from memory cards

## [v1.0.0](https://github.com/bucanero/apollo-ps2/releases/tag/v1.0.0) - 2024-12-07

### Added
Expand Down
8 changes: 5 additions & 3 deletions include/saves.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
#include <dbglogger.h>
#define LOG dbglogger_log

#define APOLLO_PATH "ms0:/APOLLO/"
#define APOLLO_PATH "APOLLO/"
#ifdef APOLLO_ENABLE_LOGGING
#define APOLLO_APP_PATH "host:/APOLLO/"
#else
#define APOLLO_APP_PATH "mass:/APOLLO/"
#endif
#define APOLLO_USER_PATH USB_PATH "PS2/EXPORT/"
#define APOLLO_DATA_PATH APOLLO_APP_PATH "DATA/"
#define APOLLO_LOCAL_CACHE APOLLO_APP_PATH "CACHE/"
Expand All @@ -22,8 +26,6 @@
#define PS1_SAVES_PATH_HDD APOLLO_PATH "PS1/"
#define PSP_SAVES_PATH_HDD USB_PATH USER_PATH_USB

#define PS1_IMP_PATH_USB "PS1/SAVEDATA/"

#define EXPORT_PATH "APOLLO/EXPORT/"

#define IMP_PS1VMC_PATH_USB "PS1/VMC/"
Expand Down
2 changes: 1 addition & 1 deletion include/settings.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define APOLLO_VERSION "1.0.0" //Apollo PS2 version (about menu)
#define APOLLO_VERSION "1.0.2" //Apollo PS2 version (about menu)

#define MENU_TITLE_OFF 30 //Offset of menu title text from menu mini icon
#define MENU_ICON_OFF 35 //X Offset to start printing menu mini icon
Expand Down
2 changes: 1 addition & 1 deletion source/exec_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static void downloadSave(const save_entry_t* entry, const char* file, int dst)
{
char path[256];

_set_dest_path(path, dst, PS2_SAVES_PATH_USB);
_set_dest_path(path, dst, (entry->flags & SAVE_FLAG_PS1) ? PS1_SAVES_PATH_USB : PS2_SAVES_PATH_USB);
if (dst == STORAGE_MC0)
snprintf(path, sizeof(path), PSP_SAVES_PATH_HDD);

Expand Down
17 changes: 11 additions & 6 deletions source/http.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <curl/curl.h>
//#include <curl/curl.h>

//#include <pspnet.h>
//#include <pspnet_inet.h>
Expand Down Expand Up @@ -154,22 +154,21 @@ static int update_progress(void *p, int64_t dltotal, int64_t dlnow, int64_t ulto

int http_download(const char* url, const char* filename, const char* local_dst, int show_progress)
{
#if 0
char full_url[1024];
CURL *curl;
CURLcode res;
// CURL *curl;
// CURLcode res;
FILE* fd;

if (network_up() != HTTP_SUCCESS)
return HTTP_FAILED;

/*
curl = curl_easy_init();
if(!curl)
{
LOG("ERROR: CURL INIT");
return HTTP_FAILED;
}

*/
fd = fopen(local_dst, "wb");
if (!fd) {
LOG("fopen Error: File path '%s'", local_dst);
Expand All @@ -180,6 +179,12 @@ int http_download(const char* url, const char* filename, const char* local_dst,
snprintf(full_url, sizeof(full_url), "%s%s", url, filename);
LOG("URL: %s >> %s", full_url, local_dst);

if (file_exists(full_url) != SUCCESS)
return HTTP_FAILED;

return (copy_file(full_url, local_dst) == SUCCESS);

#if 0
curl_easy_setopt(curl, CURLOPT_URL, full_url);
// Set user agent string
curl_easy_setopt(curl, CURLOPT_USERAGENT, HTTP_USER_AGENT);
Expand Down
18 changes: 18 additions & 0 deletions source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,24 @@ void update_vmc_path(char* path)

void update_db_path(char* path)
{
if (file_exists("cdfs:/" APOLLO_PATH "PS2/games.txt") == SUCCESS)
{
strcpy(path, "cdfs:/" APOLLO_PATH);
return;
}

if (file_exists("mass:/" APOLLO_PATH "PS2/games.txt") == SUCCESS)
{
strcpy(path, "mass:/" APOLLO_PATH);
return;
}

if (file_exists("host:/" APOLLO_PATH "PS2/games.txt") == SUCCESS)
{
strcpy(path, "host:/" APOLLO_PATH);
return;
}

strcpy(path, apollo_config.save_db);
}

Expand Down
8 changes: 5 additions & 3 deletions source/saves.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,11 @@ int ReadOnlineSaves(save_entry_t * game)
asprintf(&item->file, "%.12s", content);

item->options_count = 1;
item->options = _createMcOptions(3, "Download to Memory Card", CMD_DOWNLOAD_USB);
asprintf(&item->options->name[2], "Download to Mass Storage (mass:/)");
asprintf(&item->options->value[2], "%c%c", CMD_DOWNLOAD_USB, STORAGE_MASS);
item->options = _createMcOptions(2, "Download to Mass Storage", CMD_DOWNLOAD_USB);
memcpy(item->options->name[0] + 26, "mass:", 5);
memcpy(item->options->name[1] + 26, "host:", 5);
item->options->value[0][1] = STORAGE_MASS;
item->options->value[1][1] = STORAGE_HOST;
list_append(game->codes, item);

LOG("[%s%s] %s", game->path, item->file, item->name + 1);
Expand Down

0 comments on commit 2f97337

Please sign in to comment.