Skip to content

Commit

Permalink
add savestate location, savestate deletion, and savestate auto-load
Browse files Browse the repository at this point in the history
  • Loading branch information
rsn8887 committed Oct 27, 2018
1 parent 6225a04 commit 7e73b74
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 26 deletions.
22 changes: 16 additions & 6 deletions README.MD
Expand Up @@ -2,15 +2,15 @@ Description
=====
Use4All2 Mod is an Amiga emulator for Vita. This is my mod of the latest Vita version of this great Amiga emulator that was ported by Cpasjuste. Depending on when you read this, this mod might be ahead or behind his version.

![Screenshot of UAE4All2 Vita_mod](screenshots/uae4all2_vita_1.jpg)
![Screenshot of UAE4All2 Vita_mod](https://s14.postimg.cc/lzgf1988h/uae4all_b.jpg)

Thanks to Cpasjuste for the original port and for jumping in and adding shader support and making the assembler optimizations work.

Thanks to ScHlAuChi for extensive testing, ideas, and for contributing the new larger virtual keyboard images.

Thanks to the original authors Chui, john4p, TomB, notaz, Bernd Schneider, Toni Wilen, Pickle, smoku, AnotherGuest, Anonymous engineer, finkel, Lubomyr, pelya and many more.

Thanks to my supporters on Patreon: Andyways, CountDuckula, and Sean Ritzo.
Thanks to my supporters on Patreon: Andyways, CountDuckula, Matthew Machnee, and Sean Ritzo.

Vita-exclusive Features
======
Expand Down Expand Up @@ -38,10 +38,12 @@ Notes
- *Speed:* Most games run full speed. Some slow Amiga 1200 and WHDLoad games actually run faster if the CPU speed is reduced from 14 MHz to 7 MHz, because they rely more on custom chips than CPU. Some graphics glitches in Lionheart WHDLoad inside the caves are fixed by this.
- *Config File:* If you have problems with settings not saving etc, please delete or rename your config file in the folder "ux0:/data/uae4all" and restart the emu. I heard this can fix many problems when you are replacing an older version of this emulator with a newer version. Lots of things are changing in the config file between releases.
- *Display:* The sharp_bilinear_simple shader, on by default, creates a sharp pixel image with minimal blurring. It applies a maximum integer pre-scale first. Then it scales only the small remainder using the builtin bilinear filter, keeping the aspect ratio intact.
Many Amiga games fit the Vita screen very nicely. I urge everyone to try Chaos Engine with a screen setting of 320*200 and the sharp_bilinear_simple shader. The picture almost fills the whole screen and is very pretty with no artifacts or blurriness. The picture can be moved using R+Start+Dpad to center it on the Vita screen. It runs smooth with zero frameskip.
Many Amiga games fit the Vita screen very nicely. For example, take Chaos Engine with a screen setting of 320*200 and sharp_bilinear_simple shader enabled. The picture can be zoomed using R+Start+Dpad left/right, and moved vertically using R+Start+Dpad up/down to center it on the Vita screen. Once this is done, the picture fills almost the whole screen and looks amazing with no artifacts or blurriness. The game runs smooth with zero frameskip.
Selecting a 'Preset Width' of 320, 352 or 384 (max overscan) results in lo-res screen emulation, good for most games, while 640, 704, or 768 results in hi-res screen emulation, good for use with Workbench or some text-based games.
- *Blitter:* The Blitter settings can help with graphics glitches in some games. For example, Rick Dangerous graphics are fixed by setting Blitter to "immediate" instead of "normal," and re-booting the game. Since it works much better, "immediate" is now the default. But some games require setting Blitter to "normal" and re-booting to remove graphics glitches for example PP Hammer and Spindizzy Worlds.
- *Sprite Collisions:* Some games require sprite-to-sprite collisions. They can be turned on in the "more options" menu. The only game I know of that requires this is SpaceTaxi 3.
- *Blitter:* The blitter settings can help with graphics glitches in some games. Since it seems to work best, "immediate" is the default. But some games require setting blitter to "normal" and re-booting to remove graphics glitches, for example PP Hammer, Spindizzy Worlds, and Shufflepuck Cafe.
- *WHDLoad:* If you have problems with a WHDLoad .hdf game, maybe try an .adf version of the same game. Rock'n Roll is one of a few games that work on UAE4All2 only using .adf files. It has graphics glitches and runs too fast in WHDLoad with .hdf. To make it work correctly, I loaded the "Rock'n Roll.adf" from Gamebase Amiga, chose the preset A500 config, and changed the Blitter setting to Normal.
- *Sprite Collisions:* Some games require sprite-to-sprite collisions. Sprite collisions can be turned on in the "more options" menu. The only game I know of that requires this is SpaceTaxi 3.
- *Savestates:* Four regular savestates can be saved per game. There's also a slot for an automatic savestate, labeled "auto". If it exists, this will be loaded immediately when the .adf is inserted. To prevent this, delete the auto savestate by selecting it and choosing "delete savestate".
- *Multiplayer:* Up to four controllers on Vita TV are supported and can be fully mapped. The mouse can be switched off because it interferes with the other joystick that controls player 2 in most games. If you pair new controllers and they do not seem to work, scan for them in the "custom controls" menu by pressing L. At the bottom it will say how many controllers have been found. By default, parallel port Amiga joysticks 3 and 4 are controlled by VitaTV gamepads 3 and 4. They can also be mapped to other inputs using the custom controls screen.
- *Sound:* For use with headphones, a stereo separation setting of 50 sounds better than the default setting of 100. The original Amiga had completely disjoint left/right channels. This can sound quite jarring on headphones. Concerning sound frequency, on the Vita, the default of 44.1 kHz gives by far the best results.
- *Building from Source:* The dependencies are
Expand Down Expand Up @@ -119,6 +121,14 @@ Mouse + keyboard tested working with the "Jelly Comb Mini Bluetooth Keyboard Wit

CHANGELOG
=====
1.72

- Savestate location can now be changed in the menu

- Savestates can now be deleted from the menu

- Implemented an automatic savestate. There's a new savestate slot called auto. If it exists, this savestate will be loaded immediately when inserting a floppy.

1.71

- Fix hd settings not saving, and displayline settings not loading in certain situations
Expand Down Expand Up @@ -326,4 +336,4 @@ CHANGELOG
<1.20:
- perfect 2x scaling support to reduce pixel wobble
- HD Dir fix (supports one HD Dir & one HDF simultaneously, but max hdf size is still 1 Gb)
- Shader support implemented by Cpasjuste
- Shader support implemented by Cpasjuste
1 change: 1 addition & 0 deletions src/gp2x/menu/menu.h
Expand Up @@ -89,6 +89,7 @@ enum { MEMDISK_MENU_CASE_MAIN, MEMDISK_MENU_CASE_MISC };
#define DEFAULT_KICKSTART 1
#define DEFAULT_CPU_MODEL M68000
#define DEFAULT_SPRITECOLLISIONS 0
#define DEFAULT_USESAVESFOLDER 0

#define MENU_MEMDISK_WINDOW_WIDTH 40

Expand Down
6 changes: 5 additions & 1 deletion src/gp2x/menu/menu_config.cpp
Expand Up @@ -194,7 +194,7 @@ int mainMenu_FloatingJoystick=0;
int mainMenu_vsync=0;
#endif
char custom_kickrom[256] = "./kick.rom\0";

int mainMenu_useSavesFolder = DEFAULT_USESAVESFOLDER;

void SetDefaultMenuSettings(int general)
{
Expand Down Expand Up @@ -327,6 +327,7 @@ void SetDefaultMenuSettings(int general)
mainMenu_scanlines = 0;
mainMenu_enableScreenshots = DEFAULT_ENABLESCREENSHOTS;
mainMenu_enableScripts = DEFAULT_ENABLESCRIPTS;
mainMenu_useSavesFolder = DEFAULT_USESAVESFOLDER;
}


Expand Down Expand Up @@ -1268,6 +1269,8 @@ int saveconfig(int general)
replace (namebuffer,'|',' ');
snprintf((char*)buffer, 255, "custom_kickrom=%s\n",namebuffer);
fputs(buffer,f);
snprintf((char*)buffer, 255, "useSavesFolder=%d\n",mainMenu_useSavesFolder);
fputs(buffer,f);

fclose(f);
return 1;
Expand Down Expand Up @@ -1628,6 +1631,7 @@ void loadconfig(int general)
if (filebuffer[0]) {
strcpy(custom_kickrom, filebuffer);
}
fscanf(f,"useSavesFolder=%d\n",&mainMenu_useSavesFolder);
fclose(f);
}
// make sure the just-loaded mainMenu_displayedLines is not changed by setPresetMode
Expand Down
33 changes: 31 additions & 2 deletions src/gp2x/menu/menu_main.cpp
Expand Up @@ -864,8 +864,10 @@ int run_mainMenu()
switch(mainMenu_case)
{
case MAIN_MENU_CASE_LOAD:
{
int autostate_loaded = 0;
if(run_menuLoad(currentDir, MENU_LOAD_FLOPPY) && current_drive==0)
{
{
// Check for disk-specific config
char path[300];
create_configfilename(path, uae4all_image_file0, 0);
Expand All @@ -876,9 +878,36 @@ int run_mainMenu()
fclose(f);
loadconfig();
}
// Check for disk-specific Auto Savestate and load it automatically if possible
if (emulating)
{
int old_saveMenu_n_savestate = saveMenu_n_savestate;
saveMenu_n_savestate=4;
make_savestate_filenames(savestate_filename,NULL);
f=fopen(savestate_filename,"rb");
if (f)
{
fclose(f);
savestate_state=STATE_DORESTORE;
autostate_loaded=1;
} else
{
saveMenu_n_savestate=old_saveMenu_n_savestate;
make_savestate_filenames(savestate_filename,NULL);
}
}
}
if (autostate_loaded==1)
{
setCpuSpeed();
mainMenu_case=1;
}
else
{
mainMenu_case=-1;
}
mainMenu_case=-1;
break;
}
case MAIN_MENU_CASE_MEMDISK:
run_menuMemDisk();
if (quit_pressed_in_submenu) //User quit menu while in sub-menu
Expand Down
113 changes: 96 additions & 17 deletions src/gp2x/menu/menu_savestates.cpp
Expand Up @@ -25,19 +25,25 @@ static const char *text_str_0="0";
static const char *text_str_1="1";
static const char *text_str_2="2";
static const char *text_str_3="3";
static const char *text_str_auto="auto";
static const char *text_str_loadmem="Load State";
static const char *text_str_savemem="Save State";
static const char *text_str_deletemem="Delete State";
static const char *text_str_savestateslocation="Location";
static const char *text_str_separator="----------------------";
static const char *text_str_exit="Back to Main Menu";

extern int emulating;
extern int saveMenu_n_savestate;
extern int quit_pressed_in_submenu;
extern int mainMenu_bootHD;
extern int mainMenu_useSavesFolder;

extern void extractFileName(char * str,char *buffer);

int saveMenu_case=-1;

enum { SAVE_MENU_CASE_EXIT, SAVE_MENU_CASE_LOAD_MEM, SAVE_MENU_CASE_SAVE_MEM, SAVE_MENU_CASE_LOAD_VMU, SAVE_MENU_CASE_SAVE_VMU, SAVE_MENU_CASE_CANCEL };
enum { SAVE_MENU_CASE_EXIT, SAVE_MENU_CASE_LOAD_MEM, SAVE_MENU_CASE_SAVE_MEM, SAVE_MENU_CASE_DELETE_MEM, SAVE_MENU_CASE_LOAD_VMU, SAVE_MENU_CASE_SAVE_VMU, SAVE_MENU_CASE_CANCEL };

static inline void draw_savestatesMenu(int c)
{
Expand All @@ -54,21 +60,26 @@ static inline void draw_savestatesMenu(int c)

write_text(9,7,text_str_savestate);
if ((saveMenu_n_savestate==0)&&((c!=0)||(bb)))
write_text_inv(22,7,text_str_0);
write_text_inv(19,7,text_str_0);
else
write_text(22,7,text_str_0);
write_text(19,7,text_str_0);
if ((saveMenu_n_savestate==1)&&((c!=0)||(bb)))
write_text_inv(24,7,text_str_1);
write_text_inv(21,7,text_str_1);
else
write_text(24,7,text_str_1);
write_text(21,7,text_str_1);
if ((saveMenu_n_savestate==2)&&((c!=0)||(bb)))
write_text_inv(26,7,text_str_2);
write_text_inv(23,7,text_str_2);
else
write_text(26,7,text_str_2);
write_text(23,7,text_str_2);
if ((saveMenu_n_savestate==3)&&((c!=0)||(bb)))
write_text_inv(28,7,text_str_3);
write_text_inv(25,7,text_str_3);
else
write_text(25,7,text_str_3);
if ((saveMenu_n_savestate==4)&&((c!=0)||(bb)))
write_text_inv(27,7,text_str_auto);
else
write_text(28,7,text_str_3);
write_text(27,7,text_str_auto);

write_text(9,8,text_str_separator);

write_text(9,10,text_str_separator);
Expand All @@ -87,11 +98,32 @@ static inline void draw_savestatesMenu(int c)

write_text(9,14,text_str_separator);

if ((c==3)&&(bb))
write_text_inv(9,15,text_str_deletemem);
else
write_text(9,15,text_str_deletemem);

write_text(9,20,text_str_separator);

write_text(9,21,text_str_savestateslocation);
if (mainMenu_useSavesFolder==0)
{
if ((c!=4)||(bb))
write_text_inv(19,21,"Same as ROM ");
else
write_text(19,21,"Same as ROM ");
}
else if (mainMenu_useSavesFolder==1)
{
if ((c!=4)||(bb))
write_text_inv(19,21,"Saves Folder");
else
write_text(19,21,"Saves Folder");
}

write_text(9,22,text_str_separator);

if ((c==3)&&(bb))
if ((c==5)&&(bb))
write_text_inv(9,23,text_str_exit);
else
write_text(9,23,text_str_exit);
Expand Down Expand Up @@ -146,24 +178,24 @@ static inline int key_saveMenu(int *cp)
}
else if (up)
{
if (c>0) c=(c-1)%4;
else c=3;
if (c>0) c=(c-1)%6;
else c=5;
}
else if (down)
{
c=(c+1)%4;
c=(c+1)%6;
}
else
if (left)
if (left && c!=4)
{
if (saveMenu_n_savestate>0)
saveMenu_n_savestate--;
else
saveMenu_n_savestate=3;
saveMenu_n_savestate=4;
}
else if (right)
else if (right && c!=4)
{
if (saveMenu_n_savestate<3)
if (saveMenu_n_savestate<4)
saveMenu_n_savestate++;
else
saveMenu_n_savestate=0;
Expand All @@ -188,6 +220,23 @@ static inline int key_saveMenu(int *cp)
break;
case 3:
if (hit0)
{
saveMenu_case=SAVE_MENU_CASE_DELETE_MEM;
end=1;
}
break;
case 4:
if (left || right)
{
if (mainMenu_useSavesFolder==0)
mainMenu_useSavesFolder=1;
else
mainMenu_useSavesFolder=0;
make_savestate_filenames(savestate_filename, NULL);
}
break;
case 5:
if (hit0)
{
saveMenu_case=SAVE_MENU_CASE_EXIT;
end=1;
Expand Down Expand Up @@ -323,11 +372,25 @@ void make_savestate_filenames(char *save, char *thumb)
if (thumb!=NULL)
strcat(thumb,"-3.png");
break;
case 4:
strcat(save,"-auto.asf");
if (thumb!=NULL)
strcat(thumb,"-auto.png");
break;
default:
strcat(save,".asf");
if (thumb!=NULL)
strcat(thumb,".png");
}
if (mainMenu_useSavesFolder==1) {
char buffer[256];
if (save[0]!='\0' && save!=NULL) {
memset(buffer, 0, 256);
extractFileName(save, buffer);
memset(save, 0, 255);
snprintf(save, 255, "%s%s", SAVE_PREFIX, buffer);
}
}
}

int run_menuSavestates()
Expand Down Expand Up @@ -372,9 +435,25 @@ int run_menuSavestates()
}
break;
case SAVE_MENU_CASE_SAVE_MEM:
make_savestate_filenames(savestate_filename,NULL);
savestate_state = STATE_DOSAVE;
saveMenu_case=1;
break;
case SAVE_MENU_CASE_DELETE_MEM:
{
make_savestate_filenames(savestate_filename,NULL);
FILE *f=fopen(savestate_filename,"rb");
if (f) {
fclose(f);
if (remove(savestate_filename) == 0) {
show_error("File deleted");
} else {
show_error("File doesn't exist.");
}
}
saveMenu_case=-1;
break;
}
case SAVE_MENU_CASE_EXIT:
case SAVE_MENU_CASE_CANCEL:
saveMenu_case=1;
Expand Down

0 comments on commit 7e73b74

Please sign in to comment.