Skip to content

Commit

Permalink
Vita: - now upto four hdf files can be mounted. From my own testing, …
Browse files Browse the repository at this point in the history
…it looks like 2 Gb is the hdf size limit. Geometry for each file can be changed by manually editing the config file, default is sectors:surfaces:reserved:blocksize=32:1:2:512 for files <1 GB, 32:2:2:512 for files <1Gb and 32:4:2:512 for files >2Gb. But files >2 Gb don't seem to work.

- added a few missing files to git tracking
  • Loading branch information
rsn8887 committed Dec 30, 2016
1 parent 147605d commit c6175ff
Show file tree
Hide file tree
Showing 11 changed files with 279 additions and 64 deletions.
Binary file added psp2data/data/vkbdHires.bmp
Binary file not shown.
Binary file added psp2data/data/vkbdLargeHires.bmp
Binary file not shown.
Binary file added psp2data/data/vkbdLargeShiftHires.bmp
Binary file not shown.
30 changes: 24 additions & 6 deletions src/cfgfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "gui.h"



char * make_hard_dir_cfg_line (char *dst) {
char buffer[256];
int i;
Expand All @@ -40,15 +41,32 @@ char * make_hard_dir_cfg_line (char *dst) {
return dst;
}


char * make_hard_file_cfg_line (char *dst) {
char buffer[256];
char buffer[256];

if (uae4all_hard_file[0] != 0) {
strcpy(buffer, "32:1:2:512:");
strncat(buffer, uae4all_hard_file, 256 - strlen(buffer));
strcpy(dst, buffer);
}
if (dst[0] != 0) {

int surfaces = 1;
int sectors = 32;
int reserved = 2;
int blocksize = 512;

FILE *myFile = fopen(dst, "rb");
if (myFile == 0)
return 0;
fseek(myFile, 0, SEEK_END);
long mySize = ftell(myFile);
fclose(myFile);
if (mySize > 1048576000L && mySize <= 2097152000L)
surfaces = 2; //>1 Gb HDF but surfaces only equal to 1, change it to two.
else if (mySize > 2097152000L)
surfaces = 4; //>2 Gb HDF (DOES NOT WORK YET FOR SOME REASON)
sprintf(buffer, "%d:%d:%d:%d:", sectors, surfaces, reserved, blocksize);
//strcpy(buffer, "32:1:2:512:");
strncat(buffer, dst, 256 - strlen(buffer));
strcpy(dst, buffer);
}
return dst;
}

Expand Down
174 changes: 138 additions & 36 deletions src/gp2x/menu/menu_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,24 +193,31 @@ void SetDefaultMenuSettings(int general)
mainMenu_fastMemory = 0; /* off */
UpdateMemorySettings();

if(general < 2) {
mainMenu_bootHD=DEFAULT_ENABLE_HD;
if (hd_dir_unit_nr >= 0) {
kill_filesys_unit(currprefs.mountinfo, 0);
hd_dir_unit_nr = -1;
}
if (hd_file_unit_nr >= 0) {
kill_filesys_unit(currprefs.mountinfo, 0);
hd_file_unit_nr = -1;
}
mainMenu_filesysUnits = 0;
if(general < 2)
{
mainMenu_bootHD=DEFAULT_ENABLE_HD;
if (hd_dir_unit_nr >= 0)
{
kill_filesys_unit(currprefs.mountinfo, 0);
hd_dir_unit_nr = -1;
}
if (hd_file_unit_nr >= 0)
{
for (int i=hd_file_unit_nr; i>=0; i--)
kill_filesys_unit(currprefs.mountinfo, i);
}
hd_file_unit_nr = -1;
mainMenu_filesysUnits = 0;

}

if(general > 0) {
// hdf0
uae4all_image_file0[0] = '\0';
uae4all_image_file1[0] = '\0';
uae4all_image_file2[0] = '\0';
uae4all_image_file3[0] = '\0';

mainMenu_drives = DEFAULT_DRIVES;
}
mainMenu_floppyspeed = 100;
Expand Down Expand Up @@ -754,14 +761,17 @@ void set_joyConf()
void reset_hdConf()
{
/* Reset HD config */
if (hd_dir_unit_nr >= 0) {
if (hd_dir_unit_nr >= 0)
{
kill_filesys_unit(currprefs.mountinfo, 0);
hd_dir_unit_nr = -1;
}
if (hd_file_unit_nr >= 0) {
kill_filesys_unit(currprefs.mountinfo, 0);
hd_file_unit_nr = -1;
if (hd_file_unit_nr >= 0)
{
for (int i=hd_file_unit_nr; i>=0; i--)
kill_filesys_unit(currprefs.mountinfo, i);
}
hd_file_unit_nr = -1;
mainMenu_filesysUnits = 0;

switch (mainMenu_bootHD) {
Expand All @@ -772,27 +782,61 @@ void reset_hdConf()
if (hd_dir_unit_nr < 0) {
if (uae4all_hard_dir[0] != '\0') {
parse_filesys_spec(0, uae4all_hard_dir);
hd_dir_unit_nr = mainMenu_filesysUnits++;
hd_dir_unit_nr++;
mainMenu_filesysUnits++;
}
}
if (hd_file_unit_nr < 0) {
if (uae4all_hard_file[0] != '\0') {
parse_hardfile_spec(uae4all_hard_file);
hd_file_unit_nr = mainMenu_filesysUnits++;
if (uae4all_hard_file0[0] != '\0') {
parse_hardfile_spec(uae4all_hard_file0);
hd_file_unit_nr++;
mainMenu_filesysUnits++;
}
if (uae4all_hard_file1[0] != '\0') {
parse_hardfile_spec(uae4all_hard_file1);
hd_file_unit_nr++;
mainMenu_filesysUnits++;
}
if (uae4all_hard_file2[0] != '\0') {
parse_hardfile_spec(uae4all_hard_file2);
hd_file_unit_nr++;
mainMenu_filesysUnits++;
}
if (uae4all_hard_file3[0] != '\0') {
parse_hardfile_spec(uae4all_hard_file3);
hd_file_unit_nr++;
mainMenu_filesysUnits++;
}
}
break;
case 2:
if (hd_file_unit_nr < 0) {
if (uae4all_hard_file[0] != '\0') {
parse_hardfile_spec(uae4all_hard_file);
hd_file_unit_nr = mainMenu_filesysUnits++;
if (uae4all_hard_file0[0] != '\0') {
parse_hardfile_spec(uae4all_hard_file0);
hd_file_unit_nr++;
mainMenu_filesysUnits++;
}
if (uae4all_hard_file1[0] != '\0') {
parse_hardfile_spec(uae4all_hard_file1);
hd_file_unit_nr++;
mainMenu_filesysUnits++;
}
if (uae4all_hard_file2[0] != '\0') {
parse_hardfile_spec(uae4all_hard_file2);
hd_file_unit_nr++;
mainMenu_filesysUnits++;
}
if (uae4all_hard_file3[0] != '\0') {
parse_hardfile_spec(uae4all_hard_file3);
hd_file_unit_nr++;
mainMenu_filesysUnits++;
}
}
if (hd_dir_unit_nr < 0) {
if (uae4all_hard_dir[0] != '\0') {
parse_filesys_spec(0, uae4all_hard_dir);
hd_dir_unit_nr = mainMenu_filesysUnits++;
hd_dir_unit_nr++;
mainMenu_filesysUnits++;
}
}
break;
Expand Down Expand Up @@ -855,8 +899,8 @@ int saveconfig(int general)
path[0] = '\0';
if(mainMenu_bootHD == 1 && uae4all_hard_dir[0] != '\0')
create_configfilename(path, uae4all_hard_dir, 1);
if(mainMenu_bootHD == 2 && uae4all_hard_file[0] != '\0')
create_configfilename(path, uae4all_hard_file, 0);
if(mainMenu_bootHD == 2 && uae4all_hard_file0[0] != '\0')
create_configfilename(path, uae4all_hard_file0, 0);
if(path[0] == '\0')
return 0;
break;
Expand Down Expand Up @@ -1087,10 +1131,29 @@ int saveconfig(int general)
else
snprintf((char*)buffer, 255, "hard_disk_dir=%s\n",uae4all_hard_dir);
fputs(buffer,f);
if (uae4all_hard_file[0] == '\0')
snprintf((char*)buffer, 255, "hard_disk_file=%s\n","*");
//HDF0
if (uae4all_hard_file0[0] == '\0')
snprintf((char*)buffer, 255, "hard_disk_file0=%s\n","*");
else
snprintf((char*)buffer, 255, "hard_disk_file0=%s\n",uae4all_hard_file0);
fputs(buffer,f);
//HDF1
if (uae4all_hard_file1[0] == '\0')
snprintf((char*)buffer, 255, "hard_disk_file1=%s\n","*");
else
snprintf((char*)buffer, 255, "hard_disk_file=%s\n",uae4all_hard_file);
snprintf((char*)buffer, 255, "hard_disk_file1=%s\n",uae4all_hard_file1);
fputs(buffer,f);
//HDF2
if (uae4all_hard_file2[0] == '\0')
snprintf((char*)buffer, 255, "hard_disk_file2=%s\n","*");
else
snprintf((char*)buffer, 255, "hard_disk_file2=%s\n",uae4all_hard_file2);
fputs(buffer,f);
//HDF3
if (uae4all_hard_file3[0] == '\0')
snprintf((char*)buffer, 255, "hard_disk_file3=%s\n","*");
else
snprintf((char*)buffer, 255, "hard_disk_file3=%s\n",uae4all_hard_file3);
fputs(buffer,f);
}
snprintf((char*)buffer, 255, "chipmemory=%d\n",mainMenu_chipMemory);
Expand Down Expand Up @@ -1229,8 +1292,8 @@ void loadconfig(int general)
path[0] = '\0';
if(mainMenu_bootHD == 1 && uae4all_hard_dir[0] != '\0')
create_configfilename(path, uae4all_hard_dir, 1);
if(mainMenu_bootHD == 2 && uae4all_hard_file[0] != '\0')
create_configfilename(path, uae4all_hard_file, 0);
if(mainMenu_bootHD == 2 && uae4all_hard_file0[0] != '\0')
create_configfilename(path, uae4all_hard_file0, 0);
if(path[0] == '\0')
return;
}
Expand Down Expand Up @@ -1408,19 +1471,58 @@ void loadconfig(int general)
}
if (uae4all_hard_dir[0] == '*')
uae4all_hard_dir[0] = '\0';

fscanf(f,"hard_disk_file=",uae4all_hard_file);
uae4all_hard_file[0] = '\0';
//HDF0
fscanf(f,"hard_disk_file0=",uae4all_hard_file0);
uae4all_hard_file0[0] = '\0';
{
char c[2] = {0, 0};
*c = fgetc(f);
while (*c && (*c != '\n')) {
strcat(uae4all_hard_file0, c);
*c = fgetc(f);
}
}
if (uae4all_hard_file0[0] == '*')
uae4all_hard_file0[0] = '\0';
//HDF1
fscanf(f,"hard_disk_file1=",uae4all_hard_file1);
uae4all_hard_file1[0] = '\0';
{
char c[2] = {0, 0};
*c = fgetc(f);
while (*c && (*c != '\n')) {
strcat(uae4all_hard_file1, c);
*c = fgetc(f);
}
}
if (uae4all_hard_file1[0] == '*')
uae4all_hard_file1[0] = '\0';
//HDF2
fscanf(f,"hard_disk_file2=",uae4all_hard_file2);
uae4all_hard_file2[0] = '\0';
{
char c[2] = {0, 0};
*c = fgetc(f);
while (*c && (*c != '\n')) {
strcat(uae4all_hard_file2, c);
*c = fgetc(f);
}
}
if (uae4all_hard_file2[0] == '*')
uae4all_hard_file2[0] = '\0';
//HDF3
fscanf(f,"hard_disk_file3=",uae4all_hard_file3);
uae4all_hard_file3[0] = '\0';
{
char c[2] = {0, 0};
*c = fgetc(f);
while (*c && (*c != '\n')) {
strcat(uae4all_hard_file, c);
strcat(uae4all_hard_file3, c);
*c = fgetc(f);
}
}
if (uae4all_hard_file[0] == '*')
uae4all_hard_file[0] = '\0';
if (uae4all_hard_file3[0] == '*')
uae4all_hard_file3[0] = '\0';
}
mainMenu_drives=nr_drives;

Expand Down
10 changes: 9 additions & 1 deletion src/gp2x/menu/menu_load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ extern int run_menuFileinfo(char* fileName);
static int min_in_dir=0, max_in_dir=SHOW_MAX_FILES;

extern int current_drive;
extern int current_hdf;

#ifndef __PSP2__
#ifdef PANDORA
Expand Down Expand Up @@ -342,7 +343,14 @@ static int menuLoadLoop(char *curr_path)
if (strstr(filename, ".hdf") == NULL)
showWarning("HDF file must be selected");
else
strcpy(uae4all_hard_file, filename);
if (current_hdf==0)
strcpy(uae4all_hard_file0, filename);
else if (current_hdf==1)
strcpy(uae4all_hard_file1, filename);
else if (current_hdf==2)
strcpy(uae4all_hard_file2, filename);
else if (current_hdf==3)
strcpy(uae4all_hard_file3, filename);
break;
}
loaded=1;
Expand Down

0 comments on commit c6175ff

Please sign in to comment.